I am creating UIManagedDocument and I don't know why I get the error saying:
Thread 1: EXC_BAD_ACCES code=1 address=0xdeadbeef
The only thing in my code is the creation of this UIManagedDocument
. This function is called in viewDidLoad:
- (void)setupDatabaseDocument
{
if(!self.databaseDocument){
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
url = [url URLByAppendingPathComponent:@"Default Database"];
NSLog(@"self.databaseDocument will be initWithFileURL:%@",url);
NSLog(@"%@",[[[UIManagedDocument alloc] initWithFileURL:url] class]);
self.databaseDocument = [[UIManagedDocument alloc] initWithFileURL:url];
}
}
I tried to print through NSLog the class of [[UIManagedDocument alloc] initWithFileURL:url]
to see if it is of object type UIManagedDocument
but then the EXC_BAD_ACCESS appeared again in the NSLog line of code.
I don't know if the following details are relevant to the problem: I use Xcode 4.3.3 with iOS 5.1 Simulator. I tried running this with iOS 5.0 Simulator but the same error appeared. My Mac OS X version is 10.7.4.
Why do you think am i getting this error?