最新消息:20210917 已从crifan.com换到crifan.org

【已解决】iOS中错误:ARC Semantic issue:No visiable @interface for xxx declares the selector yyy

iOS crifan 5130浏览 0评论

【问题】

在iOS的Xcode中某个viewDidLoad函数中,写了句:

[self setDatePicker:nil];

结果出错:

no visiable interface xxx for declares the selector yyy

【解决过程】

1.后来改为:

self.dateFormatter = nil;

然后就解决问题了。

因为对应的定义为:

@interface AddSightingViewController : UITableViewController <UITextFieldDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
{
    ...
}
...
@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;

即,datePicker不是instance变量,而是property变量,所以只能用self去引用该变量才可以。

详细解释,可以参考:

【整理】Object-C中属性(property)与实例变量(instance variable)之间的区别

 

【总结】

需要注意自己定义变量时,是interface还是property,然后使用正确的方法去引用对应的变量,即可。

转载请注明:在路上 » 【已解决】iOS中错误:ARC Semantic issue:No visiable @interface for xxx declares the selector yyy

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
93 queries in 0.191 seconds, using 23.32MB memory