2010-03-01 19:13:46.924
CruzNomad[7952:207] *** -[CFString
stringByAddingPercentEscapesUsingEnCoding:]:
message sent to deallocated instance
0x58448e0
然后在(gdb)提示符下,我做了信息malloc-history 0x58448e0,它给了我:
Alloc: Block address: 0x058448e0 length: 64Stack - pthread: 0xa0b33500 number of frames: 25 0: 0x98e089bc in malloc_zone_malloc 1: 0x21516aa in _CFRuntimeCreateInstance 2: 0x2152bf8 in __CFStringCreateImmutableFunnel3 3: 0x21567d9 in CFStringCreatecopy 4: 0x21742fc in _CFStringCreateWithFormatandArgumentsAux 5: 0xdb546 in -[NSPlaceholderString initWithFormat:locale:arguments:] 6: 0xdb4d8 in +[Nsstring stringWithFormat:] 7: 0x23aa3 in -[BuisnessCardVIEwController vIEwDIDLoad] at /Users/.../Classes/BuisnessCardVIEwController.m:85 8: 0x3d6796 in -[UIVIEwController vIEw] 9: 0x347b4 in -[gm_menuVIEwController btn5_pressed:] at /Users/.../Classes/menuVIEwController.m:535 10: 0x357459 in -[UIApplication sendAction:to:from:forEvent:] 11: 0x3baba2 in -[UIControl sendAction:to:forEvent:] 12: 0x3bcdc3 in -[UIControl(Internal) _sendActionsForEvents:withEvent:] 13: 0x3bbb0f in -[UIControl touchesEnded:withEvent:] 14: 0x370e33 in -[UIWindow _sendtouchesForEvent:] 15: 0x35a81c in -[UIApplication sendEvent:] 16: 0x3610b5 in _UIApplicationHandleEvent 17: 0x2984ed1 in PurpleEventCallback 18: 0x2197b80 in CFRunLoopRunspecific 19: 0x2196c48 in CFRunLoopRunInMode 20: 0x298378d in GSEventRunModal 21: 0x2983852 in GSEventRun 22: 0x362003 in UIApplicationMain 23: 0x2c8c in main at /Users/.../source/main.m:14 24: 0x2bfa in start
第7行说问题出现在BuisnessCardVIEwController.m的第85行.那条线在这里:
fullAddress = [Nsstring stringWithFormat:@"%@ %@",fullAddress,myString];
我将附加fullAddress和myString的内容并将其存储在fullAddress中.
如果我正确地解释了这一点,那么看起来在此行之后,fullAddress被释放.当我删除断点并将鼠标悬停在变量上时,其值显示“超出范围”.
fullAddress稍后在此方法中工作.我使用它发送给谷歌,以便在相同方法的第164行中进行反向地理编码.
Nsstring *urlString = [Nsstring stringWithFormat:@"http://maps.Google.com/maps/geo?q=%@&output=csv",[fullAddress stringByAddingPercentEscapesUsingEnCoding:NSUTF8StringEnCoding]];
即使在这里,它也说“超出范围”.我很难过……任何建议?
谢谢!
托马斯
解决方法 在大多数情况下,当您不保留属性为对象并在其他方法中向其发送延迟消息时,会发生这种情况.所以,在初始化一些字符串的地方尝试:
[fullAddress retain];
要么
[myString retain];
取决于哪一个在其他方法中初始化.
总结以上是内存溢出为你收集整理的objective-c – 从NSString调试EXC_BAD_ACCESS全部内容,希望文章能够帮你解决objective-c – 从NSString调试EXC_BAD_ACCESS所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)