Don't use deprecated methods

This commit is contained in:
Damiano Galassi committed 2024-07-06 17:03:11 +02:00
1 parent c6dc4a7ecb
commit 6917c59bf1
1 file changed
+3 -6
+3 -6
View File
@@ -141,13 +141,10 @@ MP42_OBJC_DIRECT_MEMBERS
} }
- (instancetype)initWithPasteboardPropertyList:(id)propertyList - (instancetype)initWithPasteboardPropertyList:(id)propertyList
ofType:(NSPasteboardType)type ofType:(NSPasteboardType)type
{ {
if ([type isEqualToString:MP42PasteboardTypeArtwork]) { if ([type isEqualToString:MP42PasteboardTypeArtwork]) {
MP42Image *unarchivedImage = [NSKeyedUnarchiver unarchiveObjectWithData:propertyList]; return [NSKeyedUnarchiver unarchivedObjectOfClass:[MP42Image class] fromData:propertyList error:NULL];
if ([unarchivedImage isKindOfClass:[MP42Image class]]) {
return unarchivedImage;
}
} }
return nil; return nil;
@@ -164,7 +161,7 @@ MP42_OBJC_DIRECT_MEMBERS
} }
} }
else if ([type isEqualToString:MP42PasteboardTypeArtwork]) { else if ([type isEqualToString:MP42PasteboardTypeArtwork]) {
return [NSKeyedArchiver archivedDataWithRootObject:self]; return [NSKeyedArchiver archivedDataWithRootObject:self requiringSecureCoding:YES error:NULL];
} }
return nil; return nil;