iPhone 4.0 NSDateFormatter 崩溃

发布于 2024-09-11 01:20:41 字数 192 浏览 2 评论 0原文

我需要使用我的个人数据格式将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

电影里的梦 2024-09-18 01:20:41

这可能不是这段代码,而是您的应用程序中的其他问题。我写了一篇博客,介绍了查找错误的各种方法

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文