加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – 对方法的参数调用太多

发布时间:2020-12-16 07:21:11 所属栏目:百科 来源:网络整理
导读:在xCode当我使用po调试时,我得到了这个错误. (lldb) po [NSString stringWithFormat:@"tel:%@",item.CNUMBER]error: too many arguments to method call,expected 1,have 2 我看过的一些问题但对我没有帮助. Too many arguments to method call expected 1,h
在xCode当我使用po调试时,我得到了这个错误.

(lldb) po [NSString stringWithFormat:@"tel:%@",item.CNUMBER]
error: too many arguments to method call,expected 1,have 2

我看过的一些问题但对我没有帮助.

Too many arguments to method call expected 1,have 2

Too many arguments to method call

Too many arguments to method call,have 2?(Xcode)

我甚至有一个时刻,我质疑我的理智,并去了苹果文件. https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/FormatStrings.html

[NSString stringWithFormat:@"Long %C dash",0x2014]; // from apples doc

结果是一样的……

(lldb) po [NSString stringWithFormat:@"Long %C dash",0x2014];
error: too many arguments to method call,have 2

即时通讯使用macOS 10.12.4和xCode 8.3.2.我甚至从头开始重新安装xCode.什么可能导致这个想法!?

e:使用po item.CNUMBER给我的电话号码就像它应该的那样

item只是我用来解析json响应的模型,没有涉及的方法.

LeasesModel *item; // declared as an instance var

@interface LeasesModel : NSObject
@property(nonatomic,strong) NSString *ID,*PROPERTYNAME,*ADDRESS1,*ADDRESS2,*CITY,*STATE,*ZIP,*WBPOINT,*COMMENTS,*CNAME,*CNUMBER,*CEMAIL,*CCOMPANY,*ISRETAILSPACE,*ISOFFICESPACE,*ISCOMMUNITYFACILITY,*SQFT,*STATUS,*ASKINGRENT,*FLOORCOUNT,*FLOOR1SF,*FLOOR1ASKING,*FLOOR2SF,*FLOOR2ASKING,*FLOOR3SF,*FLOOR3ASKING,*FLOOR4SF,*FLOOR4ASKING,*FLOOR5SF,*FLOOR5ASKING;
@end

e:我无法在新项目中重现错误.

解决方法

感谢@danh,我们发现问题是一个NSString扩展方法.删除它允许我像平常一样调试.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读