使用未声明的标识符 "UISemanticContentAttributeForceLeftToRight" iOS 8.2?

Use of undeclared identifier "UISemanticContentAttributeForceLeftToRight" iOS 8.2?

我使用代码

 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
                                                            message:message
                                                           delegate:self
                                                  cancelButtonTitle:nil
                                                  otherButtonTitles:@"OK", nil];
[alertView setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
[alertView show];

我在第

行收到未使用标识符的错误
[alertView setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];

它适用于 iOS 9,但不适用于 iOS 8。2.How 要解决这个问题吗?

// 嗨,semanticContentAttribute 属性 仅适用于 ios 9.0,您需要检查 os 版本或尝试这样

if ([alertView respondsToSelector:NSSelectorFromString(setSemanticContentAttribute:)]) {
   [alertView setValue:[NSNumber numberWithInt:3] forKey:@"semanticContentAttribute"];
}