4

シミュレーターでアプリを実行すると、「ドキュメント」フォルダーにアプリのデータを格納するフォルダーがMacに作成されます。このフォルダーは、シミュレーターからアプリを削除したとき、または一部のアプリ設定をXCodeに変更したときに変更されます。数十のアプリがある場合、手作業で適切なアプリを見つけるのは悪夢です。

このフォルダに簡単にアクセスする方法はありますか?

4

5 に答える 5

6

答えてみてください。次のようにログに記録するのはどうですか。

    //App Directory & Directory Contents
   NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];
   NSFileManager *fileManager = [NSFileManager defaultManager];  
   NSLog(@"App Directory is: %@", appFolderPath);
   NSLog(@"Directory Contents:\n%@", [fileManager directoryContentsAtPath: appFolderPath]);
于 2012-07-11T01:49:01.867 に答える
4

私がやっていることは、Finderサイドバーにシミュレーターフォルダへのリンクを作成することです。おおよそ:

/Users/userName/Library/Application/Support/iPhone/Simulator/5.0/Applications/

次に、そのフォルダを「最終変更」でソートします。作業中のアプリのアプリフォルダーを見つけたら、それを展開してアプリを表示し(アプリ名を表示)、フォルダーに色を設定します。Finderは、ウィンドウを閉じて再度開かない限り、フォルダを「最終更新日」でソートされたままにしない場合があります。

于 2012-07-10T13:09:28.697 に答える
0

一般的な場所は次のとおりです。 /Users/yourusername/Library/Application Support/iPhone Simulator/7.1/Applications/appcode/Documents/yourdocuments.db

'yourusername':開発マシンに使用したユーザー名
'appcode':次のような一連の数字であるアプリケーション識別子:32F88907-B348-4764-9819-A5B6F9169FB7(アプリに固有)

パスのバージョン番号(7.1)は、Xcodeのバージョン、つまりシミュレーターによって異なります。

于 2014-09-11T23:25:24.940 に答える
0

directoryContentsAtPath:は非推奨です。

代わりにcontentsOfDirectoryAtPath:errorを使用してください:

 //App Directory & Directory Contents
   NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];
   NSFileManager *fileManager = [NSFileManager defaultManager];  
   NSLog(@"App Directory is: %@", appFolderPath);
    NSLog(@"Directory Contents:\n%@", [fileManager contentsOfDirectoryAtPath:appFolderPath error:nil]);

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/#//apple_ref/occ/instm/NSFileManager/directoryContentsAtPathを参照してください。

于 2016-01-03T23:45:11.740 に答える
0

Bazingaの回答およびsebrennerの非推奨通知)は、Objective-Cに最適です。

Swiftの場合、同等のものは次のようになります。

let appFolderPath = NSBundle.mainBundle().resourcePath
let fileManager = NSFileManager.defaultManager()
print("App Directory is: \(appFolderPath)")
print("Directory Contents:\n \(fileManager.contentsAtPath(appFolderPath!))")
于 2016-03-21T10:38:27.790 に答える