Read string from a file return nil
I try to read string from a file with :
NSString* path = [[NSBundle mainBundle] pathForResource:@"dirty"
ofType:@"txt"];
NSString* content = [[NSString alloc] initWithContentsOfFile:path
encoding:NSUTF8StringEncoding error:&err];
And the string i get is nil. in the error i get :
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}
Any idea what is the problem?
No comments:
Post a Comment