From 8611c88721f2cfe7af81c15a4b35c94b3486b480 Mon Sep 17 00:00:00 2001 From: Marvin Liu Date: Fri, 29 Jul 2022 15:22:03 -0700 Subject: [PATCH] fix: turn requiringSecureCoding on, adjust the available version --- Sources/Amplitude/Amplitude.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Amplitude/Amplitude.m b/Sources/Amplitude/Amplitude.m index ba5a44fb..a573c501 100644 --- a/Sources/Amplitude/Amplitude.m +++ b/Sources/Amplitude/Amplitude.m @@ -1771,7 +1771,7 @@ - (id)unarchive:(NSString *)path { } - (id)unarchive:(NSData *)data error:(NSError **)error { - if (@available(iOS 12, tvOS 11.0, macOS 10.13, watchOS 4.0, *)) { + if (@available(iOS 11, tvOS 11.0, macOS 10.13, watchOS 4.0, *)) { return [NSKeyedUnarchiver unarchivedObjectOfClass:[NSDictionary class] fromData:data error:error]; } else { #pragma clang diagnostic push @@ -1787,9 +1787,9 @@ - (id)unarchive:(NSData *)data error:(NSError **)error { } - (BOOL)archive:(id)obj toFile:(NSString *)path { - if (@available(tvOS 11.0, iOS 12, macOS 10.13, watchOS 4.0, *)) { + if (@available(tvOS 11.0, iOS 11, macOS 10.13, watchOS 4.0, *)) { NSError *archiveError = nil; - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:obj requiringSecureCoding:NO error:&archiveError]; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:obj requiringSecureCoding:YES error:&archiveError]; if (archiveError != nil) { AMPLITUDE_ERROR(@"ERROR: Unable to archive object %@: %@", obj, archiveError); return NO;