EXC_BAD_ACCESS 在设备中,而不是在模拟器中
我已经在我的项目中实现了 adwhirl 。我之前已经在我的项目中实现过它,所以我只是将它合并到我之前的项目中。
- (UIViewController *)viewControllerForPresentingModalView {
{
return self;
}
我在以前的项目中使用过这个..因为我的 window.rootvviewcontroller 是自己的。但在我当前的项目中,有很多屏幕都在显示广告,所以我使用了:
- (UIViewController *)viewControllerForPresentingModalView {
{
return return [[(AppDelegate *)[[UIApplication sharedApplication] delegate] window] rootViewController] ;;
}
主要问题是程序崩溃了,而且仍然如此。起初一切都很好:iads 测试广告已加载,但很少崩溃。我很快就明白这是因为 Admob。它很少崩溃,因为大部分时间都没有加载 admob 广告。
现在在搜索这些崩溃时,我发现了一点,因为我是在 Xcode 4.2 中创建项目而不是之前的项目 Xcode 4.0,所以我的窗口和视图控制器中有很强的属性。我把它去掉了。
现在的问题是在模拟器中它不会崩溃,但在设备中会崩溃。
错误发生在我将 adview 添加为子视图之后,并且它已经 - (UIViewController *)viewControllerForPresentingModalView
执行了此函数但是之前 adWhirlDidReceiveAd
方法。
实际崩溃是[GADRequestPrivate spamSignals] EXC_BAD_ACCESS。
I have implemented adwhirl in my project. I have implemented it previously in my projects, so I just incorporated it into my current project from my previous.
- (UIViewController *)viewControllerForPresentingModalView {
{
return self;
}
I had used this in my previous projects..since my window.rootvviewcontroller was self only. But in my current project there are many screens on which I am showing ads, so I have used:
- (UIViewController *)viewControllerForPresentingModalView {
{
return return [[(AppDelegate *)[[UIApplication sharedApplication] delegate] window] rootViewController] ;;
}
The main problem is the program was crashing, and still is. At first everything was okay: iads test ads loaded up, but it crashed rarely. I soon understand it was because of Admob. It crashed rarely because admob ads were not loaded most of the time.
Now searching for these crashes, I came across a point that since I have made the project in Xcode 4.2 rather than my previous projects Xcode 4.0 there were strong attributes in my window and view controller. I removed it.
Now the problem is in simulator it doesn't crash but it crashes in device.
The error is after I have added adview as a subview and it has - (UIViewController *)viewControllerForPresentingModalView
went through this function but before adWhirlDidReceiveAd
method.
The actual crash is [GADRequestPrivate spamSignals] EXC_BAD_ACCESS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
下面的答案已经为我赢得了赏金:).....你可以尝试解决你的问题...
链接:深入了解崩溃
我找到了调试崩溃代码的最佳方法之一。请点击调试技术的链接:
http://www.cocoadev.com/index.pl?DebuggingAutorelease
您需要非常仔细地分析您的控制台,以了解崩溃发生的实际原因。这对我几乎所有未启用 ARC 的代码都有帮助。
Below answer has already earned bounty for me :) ..... you can try for your problem...
Link : Getting to the bottom of crash
I found one of the best way to Debug the code for Crash. Follow the link for Debugging technique:
http://www.cocoadev.com/index.pl?DebuggingAutorelease
You need to analyze your Console very carefully to see actually why the Crash occurs. This helped me in almost all of the Code that are without ARC enabled.
我建议您分析您的项目并查找内存泄漏和僵尸。看起来您正在向已释放的对象发送消息,这会导致无效的内存访问。僵尸检测无法在设备上运行,但可以在模拟器上运行。查看 Xcode Instruments - 启用 NSZombie 检测?它在哪里?
希望有帮助。
I recommend you analyze your project and look for memory leaks and zombies. It seems like you are sending a message to a released object which causes the invalid memory access. The zombies detection cannot be run on the device, but you can run it on the simulator. Take a look at Xcode Instruments - Enable NSZombie Detection? Where is it?
Hope it helps.
即使这种情况发生在专有的 Adwhirl 代码中,您也可以通过打开指定的所有调试标志来学到很多东西,例如,在 如何中断 __NSAutoreleaseNoPool。这个答案讨论了很多调试标志,而不仅仅是自动释放池标志。
Even if this happens in proprietary Adwhirl code, you can learn a lot by turning on all the debugging flags as specified, for example, in How to break on __NSAutoreleaseNoPool. This answer discusses lots of debugging flags, not just autorelease pool ones.