[英]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.