简体   繁体   English

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

[英]Unable to read plist from a bundle outside my own app

What am I doing wrong? 我究竟做错了什么? Trying to read Info.plist of Calendar.app into an array but I get nil array. 尝试将Calendar.app的Info.plist读取到数组中,但得到nil数组。 Here is my code: 这是我的代码:

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);

Thank you for your help. 谢谢您的帮助。

You cant do it. 你做不到。 iOS kernel creates a sandbox environment for each of the application. iOS内核为每个应用程序创建一个沙箱环​​境。 Any application can not read/write data of other application. 任何应用程序都无法读取/写入其他应用程序的数据。 There are some possible exceptions but in general you cant do it. 有一些可能的例外,但总的来说您不能这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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