繁体   English   中英

无法从我自己的应用程序之外的捆绑软件读取plist

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM