2011-04-08 67 views
0

我在iPhone应用程序上使用CoreData。当我测试运行iOS 3.1.3上的老1克iPhone应用程序,我得到一个SIGABRT在这种方法SIGABRT在iPhone 3.1.3上使用CoreData启动应用程序时

#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] *** Terminating 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:... 

我使用的XCode 4,好像是不支持的选择,但是我认为他们在说该CoreData应该在iOS上工作> 3 .....那么为什么与它一起生成的代码不工作...

回答

2

URLsForDirectory仅在iOS 4.0及更高版本中可用

0

因为代码是不是与核心数据相关但是基础方法在自iOS 4.0以来可用的NSFileManager类中。