简体   繁体   中英

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. 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. Any application can not read/write data of other application. There are some possible exceptions but in general you cant do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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