UIWebView app crashes with Signal "0" when pdf is loaded and some monkey testing is done
I Am using UIWebView to load PDF files. I am coming to the webview from UITableViewController subclass. The PDFs are of good size.
Problem whenever I monkey test the app. It crashes and says:
Program received signal: “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")
I understand that Data formater is an error from debuger. But the signal:"0" this is related to memory (I have also seen this signal when terminating from springboard.).
I am putting a break point on view:didRecievedMemoryWarning
but he controll never goes there.
some pdfs are too lagre (7.5+ MB). If large PDFs is the problem then please suggest any other way to get those heavy PDFs load well on iphone. Following is code snippet.
//////////////////// for PDFs //////////////////
-(void)webViewloadRequest:(NSString *)URLString
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MY_WebViewController urldecode:content开发者_如何学GoURL]]];
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
if(![request isEqual:[NSNull null]])
[self.myWebView loadRequest:request];
//[self.myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:contentURL]]];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
// finished loading, hide the activity indicator in the status bar
[webActivityIndicator stopAnimating];
[self.myWebView.delegate release]; // read this somewhere in SO to retain and release the delegate.
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
NSLog(@"DOCS ABOUT TO CRASH !!!");
[self hideModalActivityIndicator];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Memory Warning!" message:@"The file was too large to load.\n So the request is terminated." delegate:self cancelButtonTitle:nil otherButtonTitles:@"ok",nil];
//[self retain];
alert.tag=MEMORY_WARNING_ALERT;
[alert show];
[alert release];
alert = nil;
// Release any cached data, images, etc. that aren't in use.
}
need Please suggest some way to refresh memory as soon as memory warning is recieved.
THank you
精彩评论