Skip to content

Commit b31cb43

Browse files
committed
Making a copy of SSYAlert now uses non-deprecated secure coding methods.
1 parent 5cd2536 commit b31cb43

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

SSYAlert.m

+17-6
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,27 @@ @implementation NSArray (SimpleDeepCopy)
107107
userInfo:nil];
108108
[ex raise] ;
109109
}
110-
archive = [NSKeyedArchiver archivedDataWithRootObject:self] ;
111-
if (archive) {
112-
copy = [NSKeyedUnarchiver unarchiveObjectWithData:archive] ;
113-
} else {
114-
NSLog(@"Error[1]: %@: Returning self since could not archive/copy %@", NSStringFromSelector(_cmd), self) ;
110+
NSError* error = nil;
111+
archive = [NSKeyedArchiver archivedDataWithRootObject:self
112+
requiringSecureCoding:YES
113+
error:&error];
114+
if (error) {
115+
NSLog(@"Internal Error 243-5742: %@: Returning self since could not archive %@", NSStringFromSelector(_cmd), self) ;
115116
copy = self;
116117
}
118+
119+
if (archive && !error) {
120+
copy = [NSKeyedUnarchiver unarchivedObjectOfClass:[SSYAlert class]
121+
fromData:archive
122+
error:&error];
123+
if (!copy || error) {
124+
NSLog(@"Internal Error 243-5743: %@: Returning self since could not unarchive %@", NSStringFromSelector(_cmd), self) ;
125+
copy = self;
126+
}
127+
}
117128
}
118129
@catch (NSException* ex) {
119-
NSLog(@"Error[2]: %@: Exception: %@. Returning self since could not un/archive %@", NSStringFromSelector(_cmd), ex, self) ;
130+
NSLog(@"Internal Error 243-5741]: %@: Exception: %@. Returning self since could not un/archive %@", NSStringFromSelector(_cmd), ex, self) ;
120131
copy = self ;
121132
}
122133
@finally { }

0 commit comments

Comments
 (0)