Search code examples
iphoneiosxcodejailbreakspringboard

How can I add the following lines to my plist file?


I have seen a lot of tutorials about adding to a plist file but I can't seem to correctly insert nested tags into the plist file. I want to add the following lines to my Info.plist file

<key>AppTag</key> <array>
     <string>hidden</string> </array>


NSMutableDictionary *plist = [[NSDictionary dictionaryWithContentsOfFile:@"/Users/me/Desktop/Info2.plist"] mutableCopy];

  [plist setObject:@"AppTag" forKey:@"key"];
  [plist setObject:@"hidden" forKey:@"string"];

    [plist writeToFile:@"/Users/me/Desktop/Info2.plist" atomically:YES];
    [plist release];

Solution

  • You need to set an array of strings as the object for key @"AppTag", like so:

    NSArray *strings = @[@"hidden"];
    plist[@"AppTag"] = strings;