我尝试从文件中读取字符串:
NSString* path = [[NSBundle mainBundle] pathForResource:@"dirty" ofType:@"txt"];
NSString* content = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&err];
我得到的字符串是零。在我得到的错误中:
Error Domain=NSCocoaErrorDomain Code=261 "The operation couldn’t be completed. (Cocoa error 261.)" UserInfo=0x21063410 {NSFilePath=/var/mobile/Applications/78889F89-B83C-480C-A246-999152EE757C/Myapp.app/dirty.txt, NSStringEncoding=4}
知道有什么问题吗?