1

私のアプリケーションでは、UIWebview を使用して HTML5 Web サイトをレンダリングします。ドロップダウンを選択すると、UITableView が埋め込まれたポップオーバーが表示されます。テーブル ビューでエントリを選択すると、JS はデータをロードします。Webkit がメイン スレッドでデータを同期的にロードしているようです。Stack is trace を以下に示します。これにより、メイン スレッドがしばらくハングし、UI がフリーズします。

私はUIWebviewのガイドラインに従っており、メインスレッドでWebビューを作成しています。

同じ Web サイトが Mobile Safari で正常に動作します。どんな助けでも大歓迎です。

#0  0x3367e004 in mach_msg_trap ()
#1  0x3367e200 in mach_msg ()
#2  0x3589a3f2 in __CFRunLoopServiceMachPort ()
#3  0x3589912a in __CFRunLoopRun ()
#4  0x3581c4a4 in CFRunLoopRunSpecific ()
#5  0x3581c36c in CFRunLoopRunInMode ()
#6  0x33edd7ca in WebCore::ResourceHandle::loadResourceSynchronously ()
#7  0x33bf5c04 in WebCore::FrameLoader::loadResourceSynchronously ()
#8  0x339ebd5a in WebCore::DocumentThreadableLoader::loadRequest ()
#9  0x339eb984 in WebCore::DocumentThreadableLoader::DocumentThreadableLoader ()
#10 0x33b65fd4 in WebCore::DocumentThreadableLoader::loadResourceSynchronously ()
#11 0x33f4880a in WebCore::ThreadableLoader::loadResourceSynchronously ()
#12 0x339eb5bc in WebCore::XMLHttpRequest::createRequest ()
#13 0x339eb35a in WebCore::XMLHttpRequest::send ()
#14 0x339eaeea in WebCore::JSXMLHttpRequest::send ()
#15 0x339ead98 in WebCore::jsXMLHttpRequestPrototypeFunctionSend ()
#16 0x356de598 in JSC::Interpreter::privateExecute ()
#17 0x3575d0ec in JSC::Interpreter::executeCall ()
#18 0x3575ccd0 in JSC::call ()
#19 0x339d5f0e in WebCore::JSEventListener::handleEvent ()
#20 0x339d5bd2 in WebCore::EventTarget::fireEventListeners ()
#21 0x338dc7c6 in WebCore::EventTarget::fireEventListeners ()
#22 0x338e2d38 in WebCore::Node::handleLocalEvents ()
#23 0x338e2588 in WebCore::EventDispatcher::dispatchEvent ()
#24 0x338e233a in WebCore::EventDispatchMediator::dispatchEvent ()
#25 0x338e230e in WebCore::EventDispatcher::dispatchEvent ()
#26 0x338e2266 in WebCore::Node::dispatchEvent ()
#27 0x33e757f4 in WebCore::Node::dispatchChangeEvent ()
#28 0x33c278aa in WebCore::HTMLFormControlElement::dispatchFormControlChangeEvent ()
#29 0x33eeb7a8 in WebCore::SelectElement::menuListOnChange ()
#30 0x33eeb7be in WebCore::SelectElement::dispatchBlurEvent ()
#31 0x33c35670 in WebCore::HTMLSelectElement::dispatchBlurEvent ()
#32 0x338e1a4e in WebCore::Document::setFocusedNode ()
#33 0x338e1788 in WebCore::FocusController::setFocusedNode ()
#34 0x33bdfdfe in WebCore::Element::blur ()
#35 0x33b802d0 in -[DOMElement blur] ()
#36 0x358c97e4 in __invoking___ ()
#37 0x358247b0 in -[NSInvocation invoke] ()
#38 0x358243ce in -[NSInvocation invokeWithTarget:] ()
#39 0x306824c0 in -[UIThreadSafeNode forwardInvocation:] ()
#40 0x358c8a82 in ___forwarding___ ()
#41 0x35823650 in __forwarding_prep_0___ ()
#42 0x30511acc in -[UIWebBrowserView resignFirstResponder] ()
#43 0x305e6658 in -[UIWebSelectTableViewController tableView:didSelectRowAtIndexPath:] ()
#44 0x3047bae4 in -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] ()
#45 0x304f57aa in -[UITableView _userSelectRowAtPendingSelectionIndexPath:] ()
#46 0x346ad932 in __NSFireDelayedPerform ()
#47 0x3589aa32 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#48 0x3589a698 in __CFRunLoopDoTimer ()
#49 0x3589926e in __CFRunLoopRun ()
#50 0x3581c4a4 in CFRunLoopRunSpecific ()
#51 0x3581c36c in CFRunLoopRunInMode ()
#52 0x3559b438 in GSEventRunModal ()
#53 0x303f7e7c in UIApplicationMain ()
4

1 に答える 1

0

リクエストを呼び出してUIWebViewにデータを渡す方法についてもう少し具体的に教えてください。

例:willStartLoadingとdidFinishLoadingを制御するようにUIWebViewDelegateを設定しましたか?NSURLRequestを同期または非同期に設定しましたか?

通常、デリゲートはUIWebViewを別のスレッドにロードして、メインがブロックされないようにします。私はあなたがそれを正しくするために特定のパラメータにもう少し取り組む必要があると思います。

于 2012-06-07T04:58:12.410 に答える