处理错误

时间:2014-08-14 07:25:28

标签: ios core-data

这是我的代码:

NSURL *storeUrl = [NSURL fileURLWithPath: [[self.applicationDocumentsDirectory] stringByAppendingPathComponent:@"DB.sqlite"]];

- (NSString *)applicationDocumentsDirectory {
    return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}

它给了我错误:期望的标识符......什么标识符?

1 个答案:

答案 0 :(得分:1)

以适当的方式调用方法。 dot(。)用于访问properties。使用s pace( )代替dot(.)

NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"DB.sqlite"]];

- (NSString *)applicationDocumentsDirectory {
    return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}