Skip to content

Commit cd516bc

Browse files
GoogleUtilities: recover Xcode 8 compatibility. (#3713)
1 parent 83195cb commit cd516bc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

GoogleUtilities/SecureCoding/GULSecureCoding.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ + (nullable id)unarchivedObjectOfClass:(Class)class
2222
fromData:(NSData *)data
2323
error:(NSError **)outError {
2424
id object;
25+
#if __has_builtin(__builtin_available)
2526
if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
2627
object = [NSKeyedUnarchiver unarchivedObjectOfClass:class fromData:data error:outError];
27-
} else {
28+
} else
29+
#endif // __has_builtin(__builtin_available)
30+
{
2831
@try {
2932
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
3033
unarchiver.requiresSecureCoding = YES;
@@ -49,11 +52,14 @@ + (nullable id)unarchivedObjectOfClass:(Class)class
4952

5053
+ (nullable NSData *)archivedDataWithRootObject:(id<NSCoding>)object error:(NSError **)outError {
5154
NSData *archiveData;
55+
#if __has_builtin(__builtin_available)
5256
if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
5357
archiveData = [NSKeyedArchiver archivedDataWithRootObject:object
5458
requiringSecureCoding:YES
5559
error:outError];
56-
} else {
60+
} else
61+
#endif // __has_builtin(__builtin_available)
62+
{
5763
@try {
5864
NSMutableData *data = [NSMutableData data];
5965
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];

0 commit comments

Comments
 (0)