Nsstring 对象更改其数据类型
我在变量中声明了某个 nsstring 属性,它用于在执行解析操作时存储文本字符串。由于此解析操作多次发生,Nsstring 属性会奇怪地更改为任何随机数据类型并导致我的应用程序崩溃。当我尝试将该属性与其他也是字符串的局部变量进行比较时,会发生这种情况。但当我进行比较时,appdelegate 变量已经更改了其数据类型,因此导致我的应用程序崩溃。
有人遇到过这样的问题吗?如果是这样,请指导我。
I have a certain nsstring property declared in a variable, it is used to do store a text string when i am performing a parsing operation. As this parsing operation happens mulitple times, the Nsstring property changes bizzardly to any random data type and crashing my application. This happens when i try to compare the property with other local variable which is also string. But by the time i compare, the appdelegate variable has already changed its data type, and hence crashes my app.
Any one ever come across such issue? If so, please guide me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您的 NSString 对象已被释放的标志,因此您可以向已释放的对象发送消息。这会使你的应用程序崩溃。数据类型发生变化,因为在对象被释放后,它所在的内存不再正确,并且可能包含垃圾。您应该使用 Run with Performance 工具 ->泄密工具。在这种情况下它很有帮助。请记住,您应该在设置中启用僵尸对象检测。
It is a sign that your NSString object has been deallocated so you send a message to a deallocated object. That crashes your application. The datatype changes because after an object is deallocated the memory it was placed in is not correct anymore and may contain a trash. You should use Run with Performance tool -> Leaks tool. It helps a lot in such cases. Please keep in mind that you should enable zombie object detection in settings.