各 .plist パス (iPhone/iPad 内) の完全なリストを取得するにはどうすればよいですか?
iOSシミュレーターで私はそれを使用しています:ls -l ~/Library/Preferences/com.apple.*.plist
私の目標は、特定のキーを見つけて、設定でブール値を読み取ることです。有効かどうかを知る必要があるためです。
これは SDK にはありませんが、設定には存在します。
Daniel A. White、Jahm、Kedar に感謝します。
これをコーディングして、各コメントを要約します。
さらに、UISupportedInterfaceOrientations 値を読み取る例を追加します。
NSLog(@"Preferences plists from apple (inside iPhone/iPad) are not accessible from code");
NSLog (@"Accessible plist paths : %@", [[NSBundle mainBundle] pathsForResourcesOfType:@"plist" inDirectory:@"/"]);
NSArray *pList = [[NSBundle mainBundle] pathsForResourcesOfType:@"plist" inDirectory:@"/"];
for (int i = 0; i < [pList count]; i ++)
{
NSString *plistPath = [pList objectAtIndex:i];
NSDictionary *plistDictionary = [NSDictionary dictionaryWithContentsOfFile:plistPath];
NSMutableArray *nameString = [plistDictionary objectForKey:@"UISupportedInterfaceOrientations"];
for (NSString *n in nameString)
{
NSLog(@"Supported Interface : %@",n);
}
}
NSLog (@"%@", [[NSBundle mainBundle] pathsForResourcesOfType:@"plist" inDirectory:@"/"]);
このメソッドは NSArray を返します。