在xCode中找不到方法定义

 chenliuyan13 发布于 2023-01-02 08:30

使用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,但也许我错过了一些东西

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有