Objective-C –预期的标识符错误 [英] Objective-C – Expected identifier error
本文介绍了Objective-C –预期的标识符错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试编译代码时出现预期的标识符错误。
I'm getting an expected identifier error when I try to compile my code.
在.h文件中设置如下careerURL:
careerURL is setup like this in .h file:
@property (nonatomic, copy) NSString *careerURL;
并在.m文件中像这样合成:
And synthesized like this in .m file:
@synthesize careerURL;
我真的不明白这里的问题是什么。确切的代码可在另一个viewcontroller中使用。
I really do not understand what is the issue here. The exact code works in another viewcontroller.
推荐答案
您应该使用点。
语法,
NSString *wtf = self.careerURL;
或Objective-C消息语法,
Or Objective-C message syntax,
NSString *wtf = [self careerURL];
不能同时使用。
这篇关于Objective-C –预期的标识符错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文