URL method does not work on 3.1.3 (generated by Core Data)
I have some issues with getting my app running on my iPhone 1G 3.1.3.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (__persistentStoreCoordinator != nil)
{
return __persistentStoreCoordinator;
}
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"MyTest.sqlite"];
...
This is copied from the code generated by xcode when I use Core Data. How can I fix the URLByAppendingPathComponent method to something that works? Should I store the path returned by applicationDocumentsDirectory-method and make a new NSURL with开发者_高级运维 that path + MyTest.sqlite or is there a better way. Thank you
Assuming [self applicationDocumentsDirectory] is an NSURL
NSString *docsDirectoryString = [[self applicationDocumentsDirectory] absoluteString]; NSString *storePathString = [docsDirectoryString stringByAppendingPathComponent:@"MyTest.sqlite"];
NSURL *storeURL = [NSURL URLWithString:storePathString];
精彩评论