在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, expected 1, 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, expected 1, 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扩展方法.删除它允许我像平常一样调试.