Flurry API 导致 iPhone 模拟器崩溃
我的应用程序在 Xcode 4.2 中使用 iOS5 和 iOS4.3 iPhone 模拟器崩溃,堆栈跟踪在 [FlurryAPI stopBackgroundTask] 方法中显示 BAD_ACCESS 信号。
虽然在 iOS4.3 模拟器中,应用程序仅在将应用程序发送到后台时崩溃,但在 iOS5 中总是崩溃。我附上一张调试导航器的图片,显示发生 BAD_ACCESS 的线程。
另一方面,该应用程序在真实设备上运行良好。
关于如何获得有关正在发生的事情以及为什么会发生这种情况的更多信息,有什么想法吗?
My app is crashing using iOS5 and iOS4.3 iPhone simulators in Xcode 4.2, the stack trace shows BAD_ACCESS signal in [FlurryAPI stopBackgroundTask] method.
While in the iOS4.3 simulator the app is only crashing when sending the app to background, in iOS5 is crashing always.I am attaching a picture of the debug navigator showing the thread where the BAD_ACCESS is happening.
On the other hand the app is working fine using a real device.
Any ideas of how can I get more information of what is going on and why this is happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我通过将以下内容添加到 didFinishLaunchingWithOptions 来解决此问题
I've worked around this issue by adding the following to didFinishLaunchingWithOptions
Flurry 分析不会在主线程之外运行。它可能会在后台线程上崩溃。
Flurry analytics does not run other than main Thread. It might crash on background thread.
看起来你有一个僵尸 - 你有这样的情况:你在发布代码后仍然使用它。保留计数达到零,因此系统释放并重新使用内存,然后您通过原始引用进行更改。现在,您对同一内存有两个不同的引用,每个引用都期望那里有一个不同的对象。就您而言,其中一份参考资料正在混乱中。
设备/模拟器差异的原因是两种体系结构使用不同的内存分配方案 - 模拟器似乎非常积极地重复使用内存。
启用 NSZombie 并在调试器中运行。如果你幸运的话,它会给你该对象以及它在释放后使用的点。
启用 NSZombie:菜单“产品”、“编辑方案...”“运行”页面、“诊断”选项卡,勾选“启用 Zombie 对象”。
It looks like you have a zombie - you have a situation where you're using code after you've released it. The retain count reaches zero, so the system dealloctes and re-uses the memory, then you make a change through the original reference. Now you have two different references to the same memory, each of which expects a different object to be there. In your case, one of the references is within flurry.
The reason for your device/simulator differences is the different memory allocation schemes the two architectures use - the simulator seems to re-use memory very aggressively.
Enable NSZombie and run in the debugger. If you're lucky, it will give you the object and the point it's used after deallocation.
Enable NSZombie: Menu 'Product', 'Edit Scheme...' 'Run' page, 'Diagnostics' tab, tick 'Enable Zombie Objects'.