我从一个没有导致错误的教程中复制了以下内容到我的项目中,它在指示的行上导致了三个错误。 (错误似乎不正确,因为当我尝试修复它们时,会出现其他错误。)任何人都可以提出可能的问题:
@interface VC ()
NSDictionary(JSONCategories) //MULTIPLE ERRORS THIS LINE including cannot declare variables inside @interface
+(NSDictionary*)dictionaryWithContentsOfJSONURLString:(NSString*)urlAddress;
-(NSData*)toJSON;
@end
最佳答案
这是一个 NSDictionary
类别;你想要:
@interface NSDictionary(JSONCategories)
+(NSDictionary*)dictionaryWithContentsOfJSONURLString:(NSString*)urlAddress;
-(NSData*)toJSON;
@end
关于IOS/objective-C : Class Method in Interface Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33170906/