1

UIWebView 出现随机崩溃。我唯一拥有的是崩溃消息。希望这足以为导致它的原因提供线索。我正在使用我自己的 webview 委托和子类化 SizingSource。谢谢。

Stacktrace:

  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at app.Application.Main (string[]) [0x00000] in /Users/vbisbest/Projects/app/MineChat/Main.cs:17
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

0   MineChat                            0x00095f7c mono_handle_native_sigsegv + 284
1   MineChat                            0x0000be98 mono_sigsegv_signal_handler + 248
2   libsystem_c.dylib                   0x9a6c759b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   UIKit                               0x02914aad -[UIWebViewWebViewDelegate webView:resource:didFinishLoadingFromDataSource:] + 63
5   CoreFoundation                      0x0134a1bd __invoking___ + 29
6   CoreFoundation                      0x0134a0d6 -[NSInvocation invoke] + 342
7   CoreFoundation                      0x0134a24a -[NSInvocation invokeWithTarget:] + 74
8   WebKit                              0x06b88881 -[_WebSafeForwarder forwardInvocation:] + 257
9   CoreFoundation                      0x01345cf9 ___forwarding___ + 905
10  CoreFoundation                      0x0134594e _CF_forwarding_prep_0 + 14
11  CoreFoundation                      0x0134a1bd __invoking___ + 29
12  CoreFoundation                      0x0134a0d6 -[NSInvocation invoke] + 342
13  WebCore                             0x079c6483 _ZL11SendMessageP12NSInvocation + 35
14  WebCore                             0x079c5ff8 _ZL20HandleDelegateSourcePv + 104
15  CoreFoundation                      0x012d9f3f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16  CoreFoundation                      0x012d996f __CFRunLoopDoSources0 + 239
17  CoreFoundation                      0x012fc734 __CFRunLoopRun + 964
18  CoreFoundation                      0x012fbf44 CFRunLoopRunSpecific + 276
19  CoreFoundation                      0x012fbe1b CFRunLoopRunInMode + 123
20  GraphicsServices                    0x04d237e3 GSEventRunModal + 88
21  GraphicsServices                    0x04d23668 GSEventRun + 104
22  UIKit                               0x0273965c UIApplicationMain + 1211
23  ???                                 0x0e39bf15 0x0 + 238665493
24  ???                                 0x0e398b78 0x0 + 238652280
25  ???                                 0x0e397ea8 0x0 + 238649000
26  ???                                 0x0e39801e 0x0 + 238649374
27  MineChat                            0x00010252 mono_jit_runtime_invoke + 722
28  MineChat                            0x0017478e mono_runtime_invoke + 126
29  MineChat                            0x00178be4 mono_runtime_exec_main + 420
30  MineChat                            0x00178f55 mono_runtime_run_main + 725
31  MineChat                            0x0006ba65 mono_jit_exec + 149
32  MineChat                            0x0021f65d main + 2013
33  MineChat                            0x00003125 start + 53
34  ???                                 0x00000004 0x0 + 4

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================


        void HandleLoadFinished (object sender, EventArgs e)
        {
            try
            {
                // New message has been added, customize the cell and size it properly
                UIWebView webView = (UIWebView)sender;
                webView.ScrollView.ScrollEnabled = false;

                // Get the height of the content
                float height = float.Parse(webView.EvaluateJavascript("document.height"));

                // Redraw the webview frame to the size of the content
                webView.Frame = new RectangleF(0,0,this.View.Frame.Width, height);
                webView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;

                // Create the dialog element with the new view
                //UIViewElement viewElement = new UIViewElement("", webView ,false);    
                WebViewElement viewElement = new WebViewElement("", webView ,false);    
                string html = webView.EvaluateJavascript("document.body.innerHTML");
                viewElement.HTML = html;
                viewElement.WebView = webView;

                viewElement.Tapped += delegate() 
                {
                    if(MessageTapped!=null)
                    {
                        MessageTapped(viewElement.HTML);
                    }
                };

                // Add it to the section
                messageSection.Add(viewElement);

                CustomSizingSource customSizingSource = (CustomSizingSource)this.TableView.Source;
                if(customSizingSource.PinToBottom)
                {

                    var lastIndexPath = viewElement.IndexPath;
                    if(lastIndexPath!=null)
                    {
                        this.TableView.ScrollToRow( lastIndexPath, UITableViewScrollPosition.Bottom, true);
                    }
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine("Error message finished loading: " + ex.Message);
            }
        }
4

0 回答 0