Ale*_*s G 57 iphone copywithzone ios
我觉得我正在把头撞到墙上(坦白说,我准备好了).
我正在尝试为视图设置背景.我需要设置的背景是一个图像,我正在使用这个代码(在其他两个UIViewController子类中运行得很好 - 这是复制/粘贴到新文件中):
UIImage *img = [gameNode imageFromKey:@"background"];
UIColor *bg = [[UIColor alloc] initWithPatternImage:img];
self.view.backgroundColor = bg;
[bg release];
Run Code Online (Sandbox Code Playgroud)
正如我所说,这在其他两个地方完美无缺,但是在这里,线路self.view.backgroundColor = bg投掷
'NSInvalidArgumentException', reason: '-[UILabel copyWithZone:]: unrecognized selector sent to instance 0x9259840'
Run Code Online (Sandbox Code Playgroud)
没有更多的东西可以去了.我在IB中验证了顶级视图的引用插座已设置为文件的所有者.我清理了项目并重新启动.我甚至关闭了Xcode并重新启动它 - 没有运气.我还缺少什么?
编辑: 正如我所提到的,没有太多的后栈跟踪,只是这样:
2012-05-28 13:13:56.997 OOKL[36012:17303] -[UILabel copyWithZone:]: unrecognized selector sent to instance 0x92b79a0
2012-05-28 13:13:56.997 OOKL[36012:17303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel copyWithZone:]: unrecognized selector sent to instance 0x92b79a0'
*** First throw call stack:
(0x2933052 0x44c7d0a 0x2934ced 0x2899f00 0x2899ce2 0x2935bd9 0xaa92dd 0x6a4f40 0x6a4eeb 0x6bfd60 0xc0191a 0x2934e1a 0x289e821 0xc0046e 0xaa7e2c 0xaa83a9 0xaa85cb 0xb2b59 0xb1969 0x2934ec9 0x9e55c2 0x9e555a 0xa8ab76 0xa8b03f 0xa8a2fe 0xa0aa30 0xa0ac56 0x9f1384 0x9e4aa9 0x2ac6fa9 0x29071c5 0x286c022 0x286a90a 0x2869db4 0x2869ccb 0x2ac5879 0x2ac593e 0x9e2a9b 0x214d 0x20c5)
Run Code Online (Sandbox Code Playgroud)
没有别的 - 在之前或之后.
Ale*_*s G 191
我想这是Xcode的一个奇怪的错误,你不能每次都跟踪或重现.我将问题缩小到IB中的一个特定UILabel.一旦我将它连接到一个IBOutlet UILabel *,我就会收到此错误.
经过进一步调查,结果发现该名称title导致了这个问题.我把标签声明为
IBOutlet UILabel *title;
Run Code Online (Sandbox Code Playgroud)
一旦我更改名称gtitle,一切都按预期工作.谁知道?..
| 归档时间: |
|
| 查看次数: |
30210 次 |
| 最近记录: |