Error “No known class method for selector 'Hello:'” in custom-made framework

跟風遠走 提交于 2019-11-29 06:26:37

You defined Hello: as an instance method, but you're sending Hello: to the class. To define a class method, you write + (void)Hello: rather than - (void)Hello:.

Tatvamasi

please refer to : https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html

to answer your question, change

@interface Hello : NSObject
-(void)Hello:(NSString *)world;
@end 

to

@interface CompanyMobile : NSObject{
}
+(void)Hello:(NSString *)world;
@end

and call the method [CompanyMobile Hello:@"world"];

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!