gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-30 19:47:24 25 4
gpt4 key购买 nike

在 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 扩展方法上。删除它后我可以像往常一样进行调试。

关于objective-c - 对方法的参数调用过多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44011841/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com