[英]Unable to read plist from a bundle outside my own app
我究竟做錯了什么? 嘗試將Calendar.app的Info.plist讀取到數組中,但得到nil數組。 這是我的代碼:
NSBundle* xyzbundle = [NSBundle bundleWithPath:@"/Applications/Calendar.app/Contents"];
// Path to the plist
NSString *path = [xyzbundle pathForResource:
@"Info" ofType:@"plist"];
// Build the array from the plist
NSMutableArray *array2 = [[NSMutableArray alloc] initWithContentsOfFile:path];
// Show the string values
for (NSString *str in array2)
NSLog(@"--%@", str);
謝謝您的幫助。
你做不到。 iOS內核為每個應用程序創建一個沙箱環境。 任何應用程序都無法讀取/寫入其他應用程序的數據。 有一些可能的例外,但總的來說您不能這樣做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.