Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 当我使用UIWebView时,主线程被阻塞_Ios_Objective C_Iphone_Uiwebview_Pthreads - Fatal编程技术网

Ios 当我使用UIWebView时,主线程被阻塞

Ios 当我使用UIWebView时,主线程被阻塞,ios,objective-c,iphone,uiwebview,pthreads,Ios,Objective C,Iphone,Uiwebview,Pthreads,今天我在我的应用程序中发现了一个与UIWebView相关的bug,有两种情况,我请求的url是https://estore-cn.pandora.net/Bracelets-1/ 当我使用UIWebView显示网页并退出该网页时,会调用webView的dealoc,但UI线程被阻止,几分钟后它会恢复 这是我在Xcode中按下暂停程序执行按钮时的线程堆栈 *线程#1:tid=0x580710,0x0000000180da3f6c libsystem_kernel.dylib`\u psynch_

今天我在我的应用程序中发现了一个与UIWebView相关的bug,有两种情况,我请求的url是
https://estore-cn.pandora.net/Bracelets-1/

当我使用UIWebView显示网页并退出该网页时,会调用webView的dealoc,但UI线程被阻止,几分钟后它会恢复

这是我在Xcode中按下
暂停程序执行
按钮时的线程堆栈


*线程#1:tid=0x580710,0x0000000180da3f6c libsystem_kernel.dylib`\u psynch_mutexwait+8,队列='com.apple.main thread',停止原因=信号SIGSTOP
*帧0:0x0000000180da3f6c libsystem\u kernel.dylib`\u psynch\u mutexwait+8
帧#1:0x0000000180e7239c libsystem_pthread.dylib`_pthread_mutex_lock_wait+96
帧2:0x0000000180e7257c libsystem_pthread.dylib`_pthread_mutex_lock_slow+296
帧#3:0x00000001850dc3b0 WebCore`\u WebTryThreadLock(bool)+52
帧#4:0x00000001850dcb3c WebCore`WebThreadLock+108
帧#5:0x00000001865abfc0 UIKit`-[UIWebView解除锁定]+36
帧#6:0x000000010032ba64 QDaily`-[QDWebView dealloc](self=0x00000001575f3980,_cmd=“dealloc”)+148位于QDWebView.m:63
帧#7:0x0000000180889ae8 libobjc.A.dylib`(匿名命名空间)::AutoreleasePoolPage::pop(void*)+508
帧#8:0x00000001810e89fc CoreFoundation`\u CFAutoreleasePoolPop+28
帧#9:0x00000001811bebc0 CoreFoundation`u CFRunLoopRun+1636
帧#10:0x00000001810e8c50 CoreFoundation`CFRunLoopRunSpecific+384
帧#11:0x00000001829d0088 GraphicsServices`GSEventRunModal+180
帧#12:0x00000001863d6088 UIKit`UIApplicationMain+204
帧#13:0x000000010037490cqdaily`main(argc=1,argv=0x000000016fd03af0)+172位于main处。m:16
帧#14:0x0000000180c868b8 libdyld.dylib`start+4

  • 第二种情况是,当我开始跳转到webView页面时,同样的情况也发生了

线程1:tid=0x5801dc,0x0000000180da3f6c libsystem\u kernel.dylib`\u psynch\u mutexwait+8,队列='com.apple.main thread',停止原因=信号SIGSTOP
帧0:0x0000000180da3f6c libsystem\u kernel.dylib`\u psynch\u mutexwait+8
帧#1:0x0000000180e7239c libsystem_pthread.dylib`_pthread_mutex_lock_wait+96
帧2:0x0000000180e7257c libsystem_pthread.dylib`_pthread_mutex_lock_slow+296
帧#3:0x00000001850dc3b0 WebCore`\u WebTryThreadLock(bool)+52
帧#4:0x00000001850dcb3c WebCore`WebThreadLock+108
框架#5:0x00000001867f3dc4 UIKit`-[UIWebView\u WebView CommonInitWithWebView:scalesPageToFit:+128
帧#6:0x00000001865a83ec UIKit`-[UIWebView initWithFrame:+80
帧#7:0x00000001002abb60 QDaily`-[QDWebView initWithFrame:(self=0x0000000000000000,_cmd=“initWithFrame:,frame=(原点=(x=0,y=20),大小=(宽度=414,高度=666))+120在QDWebView处。m:71
帧#8:0x0000000100212244 QDaily`-[QDSimpleWebViewController viewDidLoad](self=0x000000013125070,_cmd=“viewDidLoad”)+796位于QDSimpleWebViewController.m:57
帧#9:0x000000018636cc40 UIKit`-[UIViewController loadViewIfRequired]+996
帧#10:0x00000001863850d0 UIKit`-[UIViewController uU VIEW将出现:][132
帧#11:0x000000018651fe5c UIKit`-[UINavigationController(U startCustomTransition:+1052
帧#12:0x000000018642be40 UIKit`-[UINavigationController(如果需要的话)启动DeferredTransition:+688
帧#13:0x000000018642bb1c UIKit`-[UINavigationController uu视图将布局子视图]+60
帧#14:0x000000018642ba84 UIKit`-[UILayoutContainerView布局子视图]+208
帧#15:0x00000001863681e4 UIKit`-[UIView(CALayerDelegate)布局层的子层:][656
帧#16:0x0000000183cf698c QuartzCore`-[CALayer layoutSublayers]+148
帧#17:0x0000000183cf15c8 QuartzCore`CA::Layer::layout(如果需要)(CA::Transaction*)+292
帧#18:0x0000000183cf1488 QuartzCore`CA::Layer::layout_和_display_(如果需要)(CA::Transaction*)+32
帧#19:0x0000000183cf0ab8 QuartzCore`CA::Context::commit#U事务(CA::transaction*)+252
帧20:0x0000000183cf0818 QuartzCore`CA::Transaction::commit()+500
帧#21:0x000000018636aff4 UIKit`\u UIApplicationHandleEventQueue+4980
帧#22:0x00000001811c109c CoreFoundation`\uuu CFRUNLOOP\u正在调用\u OUT\u以执行\u源0\u函数\uu+24
帧#23:0x00000001811c0b30 CoreFoundation`\uU CFRunLoopDoSources0+540
帧#24:0x00000001811be830 CoreFoundation`u CFRunLoopRun+724
帧#25:0x00000001810e8c50 CoreFoundation`CFRunLoopRunSpecific+384
帧#26:0x00000001829d0088 GraphicsServices`GSEventRunModal+180
帧#27:0x00000001863d6088 UIKit`UIApplicationMain+204
帧#28:0x00000001002f490c QDaily`main(argc=1,argv=0x000000016fd83af0)+172位于main处。m:16
帧#29:0x0000000180c868b8 libdyld.dylib`start+4

我不知道如何解决它

添加:这是发生死锁时的webThread


*线程#19:tid=0x58076c,0x00000001854180f0 WebCore`WTF::HashMap::remove(unsigned long const&)+164,name='WebThread'
*帧#0:0x00000001854180f0 WebCore`WTF::HashMap::remove(无符号长常量&)+164
帧#1:0x0000000185126e54 WebCore`WebCore::DocumentLoader::removeSubresourceLoader(WebCore::ResourceLoader*)+40
帧#2:0x00000001851292a0 WebCore`WebCore::ResourceLoader::cancel(WebCore::ResourceError const&)+492
帧#3:0x0000000185087764 WebCore`WebCore::ResourceLoader::init(WebCore::ResourceRequest const&)+404
帧#4:0x00000001850873fc WebCore`WebCore::SubresourceLoader::startLoading()+36
帧#5:0x000000018508735c WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::ResourceLoadScheduler::HostInformation*,WebCore::ResourceLoadPriority)+516
帧6:0x00000001851070b8 WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::ResourceLoadPriority)+412
帧#7:0x0000000185079f