UIWebView随机崩溃在[UIViewAnimationState release]:消息发送到解除分配的实例

 chingueen_306 发布于 2022-12-14 10:23

我有一个随机UIWebView使用崩溃iOS8.1UIWebView,使用iPhone5的.在我的测试中,崩溃不会出现在iOS7上.

我创建了这个github存储库来重现崩溃:https: //github.com/crarau/WebViewCrash

基本上我正在添加一个UIWebView并加载www.amazon.com

随机的应用程序崩溃的上WebThreadEXC_ARM_BREAKPOINT

在控制台上启用Zombie跟踪后,会显示以下消息:

[UIViewAnimationState release]: message sent to deallocated instance 0x14deff70

这里UIView加载时会发生什么:

[super viewDidLoad];

NSURLRequest * urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.amazon.com"]];

self.webView.layer.cornerRadius = 0;
self.webView.userInteractionEnabled = YES;
self.webView.multipleTouchEnabled = YES;
self.webView.backgroundColor = [UIColor clearColor];
self.webView.scrollView.scrollEnabled = NO;
self.webView.scrollView.bounces = NO;
[self.webView loadRequest:urlRequest];

异常堆栈跟踪:

    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000001, 0x000000000000defe
    Triggered by Thread:  2

    Thread 0 name:  Dispatch queue: com.apple.main-thread
    Thread 0:
    0   libsystem_kernel.dylib          0x2fe054f0 mach_msg_trap + 20
    1   libsystem_kernel.dylib          0x2fe052e4 mach_msg + 36
    2   CoreFoundation                  0x21fed936 __CFRunLoopServiceMachPort + 142
    3   CoreFoundation                  0x21febedc __CFRunLoopRun + 1012
    4   CoreFoundation                  0x21f3a20c CFRunLoopRunSpecific + 472
    5   CoreFoundation                  0x21f3a01e CFRunLoopRunInMode + 102
    6   GraphicsServices                0x293330a4 GSEventRunModal + 132
    7   UIKit                           0x255461cc UIApplicationMain + 1436
    8   WebViewCrash                    0x0002deec main (main.m:14)
    9   libdyld.dylib                   0x2fd52aac start + 0

    Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
    Thread 1:
    0   libsystem_kernel.dylib          0x2fe052a0 kevent64 + 24
    1   libdispatch.dylib               0x00162674 0x154000 + 58996
    2   libdispatch.dylib               0x00157496 0x154000 + 13462

    Thread 2 name:  WebThread
    Thread 2 Crashed:
    0   CoreFoundation                  0x2202aea2 ___forwarding___ + 534
    1   CoreFoundation                  0x21f5cdf4 _CF_forwarding_prep_0 + 20
    2   CoreFoundation                  0x21f2ee58 CFRelease + 596
    3   QuartzCore                      0x24f0ba60 CA::release_objects(X::List*) + 12
    4   QuartzCore                      0x24f10dc2 -[CAAnimation dealloc] + 50
    5   libobjc.A.dylib                 0x2f7ecd5a objc_object::sidetable_release(bool) + 162
    6   libobjc.A.dylib                 0x2f7ed1a4 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 400
    7   CoreFoundation                  0x21fee2a4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 12
    8   CoreFoundation                  0x21fede1e __CFRunLoopDoTimer + 646
    9   CoreFoundation                  0x21fec06e __CFRunLoopRun + 1414
    10  CoreFoundation                  0x21f3a20c CFRunLoopRunSpecific + 472
    11  CoreFoundation                  0x21f3a01e CFRunLoopRunInMode + 102
    12  WebCore                         0x2d362ebe RunWebThread(void*) + 414
    13  libsystem_pthread.dylib         0x2fe95e90 _pthread_body + 136
    14  libsystem_pthread.dylib         0x2fe95e02 _pthread_start + 114
    15  libsystem_pthread.dylib         0x2fe93b8c thread_start + 4

任何建议表示赞赏谢谢

2 个回答
  • 我在iOS 8上遇到了同样的问题,更具体地说,iPad 3比其他人更容易失败.

    基于你的帖子以及我能够找到的其他几个帖子,它似乎UIWebView仅在iOS8 上存在问题,因为它适用于iOS7.

    我所做的是WKWebView在iOS8 上使用新版本,它不会出现同样的问题,同时继续UIWebView在iOS7 上使用.

    最好的办法是用Apple提供雷达并WKWebView在此期间切换到.

    2022-12-14 10:25 回答
  • 如果您不使用动画,则可以通过禁用动画来避免此错误.把它放在你的控制器init方法中:

    [UIView setAnimationsEnabled:NO];
    

    2022-12-14 10:26 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有