2

ドキュメント ディレクトリに移動する必要があるアプリ リソース バンドルに JavaScript ファイルを追加しましたが、パスのコピーを開始すると null が返されます。

コード:

NSString *jsPath = [[NSBundle mainBundle] pathForResource:@"jsFile" ofType:@"js"];
NSString *copyPath = [path stringByAppendingString:@"/jsFile.js"];  //path is the documents dir
NSLog(@"%@", jsPath); //Output of this is (null)

if ([[NSFileManager defaultManager] fileExistsAtPath:jsPath]) //returns false
[[NSFileManager defaultManager] copyItemAtPath:jsPath toPath:copyPath error:nil];

誰もこれに非常に遭遇したことがありますか?

4

1 に答える 1

3

js ファイルがバンドルにコピーされているのではなく、コンパイルされているかどうかを確認してください。現在のターゲットの「ビルドフェーズ」の下を調べる必要があります...

于 2012-02-26T14:36:30.950 に答える