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

fix: turn requiringSecureCoding on, adjust the available version #407

Merged
merged 1 commit into from
Jul 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/Amplitude/Amplitude.m
Original file line number Diff line number Diff line change
Expand Up @@ -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, *)) {
liuyang1520 marked this conversation as resolved.
Show resolved Hide resolved
return [NSKeyedUnarchiver unarchivedObjectOfClass:[NSDictionary class] fromData:data error:error];
} else {
#pragma clang diagnostic push
Expand All @@ -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;
Expand Down