iPhone 4.0 NSDateFormatter 崩溃
我需要使用我的个人数据格式将 NSDate 转换为字符串...... 问题是模拟器(4.01)上的这段代码崩溃了...... 有时代码被“冻结”,有时给出 BAD_ACCESS... 这是代码:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
I need to convert a NSDate to a string using my personal data format...
The problem is that this code on the simulator (4.01) crashes...
sometimes the code is "freezed", sometimes give the BAD_ACCESS...
here is the code:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能不是这段代码,而是您的应用程序中的其他问题。我写了一篇博客,介绍了查找错误的各种方法
http://www.loufranco.com/blog/files/debug-iphone-crash-EXC_BAD_ACCESS.html
问题是您在进行错误的内存访问时获得 EXC_BAD_ACCESS,而不是在损坏时获得 EXC_BAD_ACCESS堆或引起了根本问题。
如果 alloc 崩溃,则很有可能您的堆已损坏,并且损坏发生在该代码之前。
It's likely not this code, but some other problem in your app. I wrote a blog that goes through the various ways to find the bug
http://www.loufranco.com/blog/files/debug-iphone-crash-EXC_BAD_ACCESS.html
The issue is you get EXC_BAD_ACCESS at the point that a bad memory access is made, not at the point that corrupted the heap or caused the underlying problem.
If alloc is crashing, it's a good bet that your heap is corrupt, and that the corruption happened earlier than this code.