-
-
Save anonymous/816bb587194287155a8f to your computer and use it in GitHub Desktop.
nsmutabledictionary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
@implementation AppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSString *mainPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Desktop"]; | |
NSString *plist1 = [mainPath stringByAppendingString:@"plist1.plist"]; | |
NSString *plist2 = [mainPath stringByAppendingString:@"plist2.plist"]; | |
NSMutableDictionary *dict1 = [NSMutableDictionary dictionaryWithContentsOfFile:plist1]; | |
NSMutableDictionary *dict2 = [NSMutableDictionary dictionaryWithContentsOfFile:plist2]; | |
[dict1[@"Main"] addEntriesFromDictionary:dict2[@"Main"]]; | |
NSLog(@"%@",dict1); | |
} | |
/* | |
// output is: { | |
Main = { | |
DataStorage2 = { | |
A = ""; | |
B = ""; | |
C = ""; | |
}; | |
}; | |
} | |
*/ | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Main</key> | |
<dict> | |
<key>DataStorage1</key> | |
<dict> | |
<key>A</key> | |
<string></string> | |
<key>B</key> | |
<string></string> | |
<key>C</key> | |
<string></string> | |
</dict> | |
</dict> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Main</key> | |
<dict> | |
<key>DataStorage2</key> | |
<dict> | |
<key>A</key> | |
<string></string> | |
<key>B</key> | |
<string></string> | |
<key>C</key> | |
<string></string> | |
</dict> | |
</dict> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment