0

私のアプリでは、拡張子が.txtで、ファイルがアプリにあるファイルのコンテンツを取得しようとしています。私は以下を試しています

path = [[NSBundle mainBundle] pathForResource:@"Last"
                                         ofType:@"txt"];

content = [NSString stringWithContentsOfFile:path
                                    encoding:NSUTF8StringEncoding
                                       error:NULL];

lines = [content componentsSeparatedByString:@"\n"];
NSLog(@"Content Length: %i", [lines count]);
NSLog(@"%@ %@",content,path);

ただし、コンテンツとパスは印刷されますnull。何が悪いのか知っている人はいますか?

ありがとう。

4

1 に答える 1