Merge pull request #81 from jpetrie/propertylist-serialization-warnings

Fix NSPropertyListSerialization deprecation warnings.
This commit is contained in:
Douglas Drumond
2015-10-07 03:56:29 -03:00
2 changed files with 24 additions and 1 deletions
+3 -1
View File
@@ -40,7 +40,9 @@
#ifndef MAC_OS_X_VERSION_10_10_3
# define MAC_OS_X_VERSION_10_10_3 101003
#endif
#ifndef MAC_OS_X_VERSION_10_11
# define MAC_OS_X_VERSION_10_11 101100
#endif
//
// This is the protocol MMBackend implements.
+21
View File
@@ -304,19 +304,32 @@ debugStringForMessageQueue(NSArray *queue)
+ (id)dictionaryWithData:(NSData *)data
{
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10
id plist = [NSPropertyListSerialization
propertyListWithData:data
options:NSPropertyListImmutable
format:NULL
error:NULL];
#else
id plist = [NSPropertyListSerialization
propertyListFromData:data
mutabilityOption:NSPropertyListImmutable
format:NULL
errorDescription:NULL];
#endif
return [plist isKindOfClass:[NSDictionary class]] ? plist : nil;
}
- (NSData *)dictionaryAsData
{
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10
return [NSPropertyListSerialization dataWithPropertyList:self
format:NSPropertyListBinaryFormat_v1_0 options:0 error:NULL];
#else
return [NSPropertyListSerialization dataFromPropertyList:self
format:NSPropertyListBinaryFormat_v1_0 errorDescription:NULL];
#endif
}
@end
@@ -328,11 +341,19 @@ debugStringForMessageQueue(NSArray *queue)
+ (id)dictionaryWithData:(NSData *)data
{
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10
id plist = [NSPropertyListSerialization
propertyListWithData:data
options:NSPropertyListMutableContainers
format:NULL
error:NULL];
#else
id plist = [NSPropertyListSerialization
propertyListFromData:data
mutabilityOption:NSPropertyListMutableContainers
format:NULL
errorDescription:NULL];
#endif
return [plist isKindOfClass:[NSMutableDictionary class]] ? plist : nil;
}