Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSPropertyListSerialization mutabilityOption not working for binary plists when not using ARC #538

Closed
rupertdaniel opened this issue Jun 7, 2016 · 0 comments

Comments

@rupertdaniel
Copy link

When using NSPropertyListSerialization to create a mutable dictionary from a binary plist file and not using ARC, it does not return a mutable object.

Example:

// Load binary plist data
NSData *binaryPlistData  = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"Data" withExtension:@"plist"]]; 

// Create mutable dict from data
NSMutableDictionary *d = (NSMutableDictionary *)[NSPropertyListSerialization propertyListFromData:binaryPlistData mutabilityOption:NSPropertyListMutableContainers format:NULL errorDescription:nil];

// Try to add object
[d setObject:@"test" forKey:@"object"];  // Raises exception about not being mutable

Doing the same under ARC returns a mutable dictionary as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants