Crash With WebView in iPhone

0

I get following crash when I open a URL consecutively for 3 to 4 times in my app inside a 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

What could be wrong?

- (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];
}
iphone
objective-c
webview
uiwebviewdelegate
asked on Stack Overflow Aug 1, 2011 by Parth Bhatt • edited Aug 1, 2011 by Parth Bhatt

1 Answer

0

Got the solution. Got an NSZombie wherein I was releasing the object and then trying to access it. Got the desired result after I made use of Instruments to find out the NSZombie.

answered on Stack Overflow Aug 1, 2011 by Parth Bhatt

User contributions licensed under CC BY-SA 3.0