我正在尝试制作一个简单的笔记应用程序。当我运行项目时,在调试区域中,它说;
[1752:19d03] -[TableViewController createEditableCopyOfDatabasteIfNeeded]: unrecognized selector sent to instance 0xa147d20
[1752:19d03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TableViewController createEditableCopyOfDatabasteIfNeeded]: unrecognized selector sent to instance 0xa147d20'
而我的代码,包括createEditableCopyOfDatabasteIfNeeded,是;
- (void)createEditableCopyOfDatabaseIfNeeded {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *documentDirectory = [self applicationDocumentsDirectory];
NSString *writableDBPath = [documentDirectory stringByAppendingPathComponent:@"NotesList.plist"];
BOOL dbexits = [fileManager fileExistsAtPath:writableDBPath];
if (!dbexits) {
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"NotesList.plist"];
NSError *error;
BOOL success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
if (!success) {
NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
}
}
}
这里的问题在哪里? 这可能很容易,但我是 Xcode 的新手。 感谢帮助