2011-08-01 76 views
0

当我在webView中的应用程序中连续打开3到4次URL时,出现以下崩溃。iPhone中的WebView崩溃

Exception Type: EXC_BAD_ACCESS (SIGBUS) 
Exception Codes: EXC_ARM_DA_ALIGN at 0x0062006f 
Crashed Thread: 0 

Thread 0 Crashed: 
0 libSystem.B.dylib    0x0000576c OSAtomicCompareAndSwap32 + 0 
1 libobjc.A.dylib     0x000066ce changeInfo(class_t*, unsigned int,  unsigned int) + 22 
2 libobjc.A.dylib     0x00008412 realizeClass(class_t*) + 38 
3 libobjc.A.dylib     0x0000862c prepareForMethodLookup + 44 
4 libobjc.A.dylib     0x0000538a lookUpMethod + 34 
5 libobjc.A.dylib     0x00002b82 _class_lookupMethodAndLoadCache + 6 
6 libobjc.A.dylib     0x000028b8 objc_msgSend_uncached + 20 
7 UIKit       0x001d68c2 -[UIWebView webView:didFinishLoadForFrame:] + 214 
8 UIKit       0x001d5e0c -[UIWebViewWebViewDelegate webView:didFinishLoadForFrame:] + 16 
9 CoreFoundation     0x0009f06c __invoking___ + 60 
10 CoreFoundation     0x00032706 -[NSInvocation invoke] + 102 
11 WebCore       0x00044d42 SendMessage(NSInvocation*) + 10 
12 WebCore       0x0005846e HandleDelegateSource(void*) + 62 
13 CoreFoundation     0x00071a86 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6 
14 CoreFoundation     0x00073768 __CFRunLoopDoSources0 + 376 
15 CoreFoundation     0x00074504 __CFRunLoopRun + 224 
16 CoreFoundation     0x0001d8e4 CFRunLoopRunSpecific + 224 
17 CoreFoundation     0x0001d7ec CFRunLoopRunInMode + 52 
18 GraphicsServices    0x000036e8 GSEventRunModal + 108 
19 GraphicsServices    0x00003794 GSEventRun + 56 
20 UIKit       0x000062a0 -[UIApplication _run] + 396 
21 UIKit       0x00004e10 UIApplicationMain + 664 

什么可能是错的?

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 
{ 
     NSLog(@"Button Clicked!"); 

return YES; 
} 

- (void)webViewDidStartLoad:(UIWebView *)webView 
{ 
orkutURLString = @""; 

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:TRUE]; 
} 

- (void)webViewDidFinishLoad:(UIWebView *)webView 
{ 
NSURL *currentURL = orkutWebView.request.mainDocumentURL; 

NSLog(@"Relative URL: %@",[currentURL relativePath]); 

NSArray *urllistItems = [[currentURL relativePath] componentsSeparatedByString:@"/"]; 

if([urllistItems count]>1) 
{ 
    orkutURLString = [urllistItems objectAtIndex:1]; 
    orkutURLString = [orkutURLString lowercaseString]; 

    if([orkutURLString isEqualToString:@"share"]) 
    { 
     orkutWebView = nil; 
     [orkutWebView removeFromSuperview]; 
     [orkutView removeFromSuperview]; 
     NSString *message1 = NSLocalizedStringFromTableInBundle(@"Your status update was sent", @"Localizable", [NewfoxRadioAppDelegate GetLocalizebundle], @""); 
     UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Newfox Radio" message:message1 delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
     [alertView show]; 
     [alertView release]; 
    } 
} 

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE]; 
} 

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error 
{ 
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE]; 
} 
+0

你用过webview委托方法吗? –

+0

你是否在使用网页浏览器的指标? – SJS

+0

@HonestSuccess:不,我不使用UIWebView的指标 –

回答

0

得到了解决办法。有一个NSZombie,其中我释放的对象,然后试图访问它。在使用仪器找出NSZombie之后得到了理想的结果。