Hi guys, you are my last chance to find this mistake. I searched all day and could not find anything.
What I am doing is saving the PDF file from the network locally and then uploading it to webView . On iOS 4.0 and 4.1, it gives me a BAD_ACCESS error, while on iOS 4.2 and 4.3 it works fine.
This is the code I'm using:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"press.pdf"]; filePath = [[NSURL fileURLWithPath:path]retain]; NSError *err =nil; if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
I tried to enable NSAutoreleaseFreedObjectCheckEnabled , NSZombieEnabled and NSDebugEnabled , but I get nothing in the console. Xcode just stops at this line:
int retVal = UIApplicationMain(argc, argv, nil, nil);
and EXC_BAD_ACCESS states
I do not know what it can be and where to look further. Please, help
EDIT: I forgot to mention that if I comment on the next line, this is obviously not a failure because nothing is loaded in the webView.
[webView loadData:pdfFile MIMEType:@"application/pdf" textEncodingName:@"utf-8" baseURL:nil];
source share