Ios 对于';没有可见的@界面;NSString';声明选择器';boundingRectWithSize:选项:属性:上下文:';
我正在尝试运行最近完成的Xcode项目,我有一个错误需要排序。非常感谢您的帮助 错误之前出现语义问题-警告如下: 未声明的选择器“boundingRectWithSize:options:Atributes:context” ARC语义问题错误如下: “NSString”没有可见的@interface声明选择器“boundingRectWithSize:options:attributes:context:” 代码如下Ios 对于';没有可见的@界面;NSString';声明选择器';boundingRectWithSize:选项:属性:上下文:';,ios,objective-c,ios7,Ios,Objective C,Ios7,我正在尝试运行最近完成的Xcode项目,我有一个错误需要排序。非常感谢您的帮助 错误之前出现语义问题-警告如下: 未声明的选择器“boundingRectWithSize:options:Atributes:context” ARC语义问题错误如下: “NSString”没有可见的@interface声明选择器“boundingRectWithSize:options:attributes:context:” 代码如下 // Since sizeWithFont() method has bee
// Since sizeWithFont() method has been depreciated, boundingRectWithSize() method has been used for iOS 7.
if ([NSString instancesRespondToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) {
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.lineBreakMode = NSLineBreakByClipping;
CGRect requiredLabelRect = [self.textLabel.text boundingRectWithSize:contentViewSize
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:self.textLabel.font,
NSParagraphStyleAttributeName: paragraphStyle
}
context:nil];
您的项目的基本SDK和部署目标是什么?您可以通过说
[(id)(self.textlab.text)bounding…
来消除警告(如果这是您想要的)。可能是您无意中使用OS X(AppKit)SDK编译了此代码吗?您使用的API是特定于UIKit的。您是否尝试过这样编译代码(使用#if#endif指令):并且不要让此代码可为ios 7以外的SDK编译。ARGGGH!!!将Xcode更新为最新版本,错误消失了!