I have a very weird problem I've spent the last two days trying to solve... I had a piece of code that was working perfectly fine on Xcode 4.4 and iOS 5.1 Simulator, using the 5.1 SDK. After I updated to Xcode 4.5 and the 6.0 SDK, my code stopped working in the iOS 5.1 Simulator... even though it works perfectly fine in the iOS 6.0 Simulator. Was there any change I'm not aware of?
This is the code:
- (void)useDocument
{
if (![[NSFileManager defaultManager] fileExistsAtPath:[self.database.fileURL path]]){
[self.database saveToURL:self.database.fileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success){
[self setupFetchedResultsController];
}];
} else if (self.database.documentState == UIDocumentStateClosed){
[self.database openWithCompletionHandler:^(BOOL success){
[self setupFetchedResultsController];
}];
} else if (self.database.documentState == UIDocumentStateNormal) {
[self setupFetchedResultsController];
}
}
For some reason saveToURL and openWithCompletionHandler never return in the 5.1 Simulator. Any one knows why?