使用xCode 5.1,Objective C
刚开始尝试使用Objective C,编写一个简单的程序,并得到一些警告:
Method definition for "some method" not found...
我正在查看我的代码,我在实现文件(.m)屏幕中看到了方法.
我知道 - 看到很多类似的问题:
这里 - 信件案例的差异 - 检查一切都没问题
这里 - 调用.m文件中不存在的方法 - 检查 - 存在
这里 - 和上一个问题一样.题
在这里 - 怪异/非标准设置Apple - 一切都好
这里 - 不正确的实施
这里 - 错过参数,所以执行不正确
和其他相同的错误......
所以根据这篇文章,我认为问题是或缺少声明/实现或一些语法错误
检查我的代码看起来一切正常.
声明 - 在.h文件中
//- mean non static method //(return type) Method name : (type of var *) name of var - (void)addAlbumWithTitle : (NSString *) title //global name of var : (type of var *) local name of var artist : (NSString *) artist : summary : (NSString *) summary : price : (float) price : locationInStore : (NSString *) locationInStore;
在.m文件中实现
- (void)addAlbumWithTitle:(NSString *)title artist:(NSString *)artist summary:(NSString *)summary price:(float)price locationInStore:(NSString *)locationInStore { Album *newAlbum = [[Album alloc] initWithTitle:title artist:artist summary:summary price:price locationInStore:locationInStore]; [self.albumList addObject:newAlbum]; }
我只是开始尝试用xCode尝试Objective C,但也许我错过了一些东西