【发布时间】:2014-07-20 12:46:05
【问题描述】:
使用 Xcode 5.1,Objective-C
刚开始尝试使用Objective-C,写了一个简单的程序,得到了一些警告:
未找到“某些方法”的方法定义...
我正在查看我的代码,并在实现文件 (.m) 中看到了方法 屏幕。
我知道 - 看到很多类似的问题:
- Here - 字母大小写的差异 - 检查一切正常
- Here - 调用 .m 文件中不存在的方法 - 检查 - 存在
- Here - 与上一个相同的问题。问题
- Here - 奇怪/非标准设置 Apple - 一切正常
- Here - 不正确的实现
- Here - 缺少参数,所以执行不正确
- 以及其他相同的错误...
所以根据这篇文章,我认为问题在于缺少声明/实现或某些语法错误
检查我的代码是否一切正常。
声明 - 在 .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,也许我错过了什么
【问题讨论】:
-
您是否尝试过清理和重建您的项目?
-
多试几次——第一次我几乎没有错误和警告,现在只剩下一个
标签: ios objective-c xcode