SIGABRT when launching app with CoreData on iPhone 3.1.3
I am using CoreData on my iPhone app. When I test the app on a old 1g iPhone running iOS 3.1.3 I get a SIGABRT in this method
#pragma mark - Application's Documents directory
/**
Returns the URL to the application's Documents directory.
*/
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
*** -[NSFileManager URLsForDirectory:inDomains:]: unrecognized selector sent to instance 0x106920
2011-04-08 23:49:26.311 TestApp[963:207] *** Te开发者_如何学Gorminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSFileManager URLsForDirectory:inDomains:]: unrecognized selector sent to instance 0x106920'
2011-04-08 23:49:26.321 TestApp[963:207] Stack:...
I am using XCode 4. It seems like the selector is not supported, however I thought they were saying that CoreData should work on iOS > 3.....so why are does the code that is generated along with it not working...
URLsForDirectory is only available in iOS 4.0 and later
Because the code is NOT related to Core Data but to an Foundation method on the NSFileManager class which is available since iOS 4.0.
精彩评论