iOS:删除的代码继续影响应用程序
我从对象中删除了一个属性;我确保脱下后没有提及它;但是当我运行该应用程序时,它在某种方法上崩溃,说它找不到我已删除的这个属性。
更具体地说,我在方法中使用了此属性,日志中收到的错误是:
2011-08-04 15:32:17.895 myApp[10125:207] -[myUIViewController aMethodName:anAttributeThatIHadDeleted:]: 无法识别的选择器发送到实例 0x5e5d010 2011-08-04 15:32:17.962 myApp [10125:207]由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[myUIViewController aMethodName:anAttributeThatIHadDeleted:]:发送到实例的无法识别的选择器0x5e5d010'
我尝试了以下操作,它没有帮助:
- 我确保这个 anAttributeThatIHadDeleted 不会出现在这个方法中(也不会出现在 h 文件中,也不会出现在 m 文件中)
- 我从 iPhone 模拟器中删除了该应用程序,然后执行了 Product > ;>清理
- 我什至关闭了模拟器,关闭了应用程序,在我执行此删除+清理操作后,
有人能想到我还能做些什么来解决这个问题吗?
I removed an attribute from an object; I made sure there is no reference to it after I took it off; but when I run the app it crashes upon a certain method saying that it cannot find this attribute that I had removed.
To be more specific, I used this attribute in a method and the error I get in the log is:
2011-08-04 15:32:17.895 myApp[10125:207] -[myUIViewController aMethodName:anAttributeThatIHadDeleted:]: unrecognized selector sent to instance 0x5e5d010
2011-08-04 15:32:17.962 myApp[10125:207] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[myUIViewController aMethodName:anAttributeThatIHadDeleted:]: unrecognized selector sent to instance 0x5e5d010'
I tried the following and it didn't help:
- I made sure that this anAttributeThatIHadDeleted does not appear in this method (nor in the h file neither in the m file)
- I deleted the app from the iPhone Simulator, and then did Product >> Clean
- I even closed the simulator, closed the application, after I did this delete + clean actions
Can anyone think of anything else I can do to resolve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您绝对确定该方法不再存在,我会将其从模拟器中删除,退出模拟器,退出 XCode,删除项目 Finder 中的“build”文件夹,然后再次启动它们
If you're absolutely sure the method doesn't exist anymore, I'd delete it from the simulator, quit the simulator, quit XCode, delete the "build" folder in Finder of you project and then start them all again
有件事我忘了做......
删除界面生成器>> UIButton 连接到文件所有者 IBAction 方法并将其重新连接到新方法(这是同一个方法,我刚刚从中删除了一个属性,但显然它不与 IB 同步,您必须手动执行此操作.. .)
There was one thing I forgot to do.....
Deleting the Interface Builder >> UIButton connection to the File's Owner IBAction method and re-connecting it to the new one (it was the same one, I just deleted an attribute from it, but apparently it doesn't sync with IB, you have to do it manually...)