@@ -138,8 +138,16 @@ - (void)testOldArchiveFormat {
138138// Deprecated in iOS 13 and macOS 10.14
139139- (void )testLegacyCoding {
140140 GIDProfileData *profileData = [self profileData ];
141- NSData *data = [NSKeyedArchiver archivedDataWithRootObject: profileData];
142- GIDProfileData *newProfileData = [NSKeyedUnarchiver unarchiveObjectWithData: data];
141+ NSError *archiveError;
142+ NSData *data = [NSKeyedArchiver archivedDataWithRootObject: profileData
143+ requiringSecureCoding: NO
144+ error: &archiveError];
145+ XCTAssertNil (archiveError);
146+ NSError *unarchiveError;
147+ GIDProfileData *newProfileData = [NSKeyedUnarchiver unarchivedObjectOfClass: [GIDProfileData class ]
148+ fromData: data
149+ error: &unarchiveError];
150+ XCTAssertNil (unarchiveError);
143151 XCTAssertEqualObjects (profileData, newProfileData);
144152 XCTAssertTrue (GIDProfileData.supportsSecureCoding );
145153}
@@ -149,8 +157,16 @@ - (void)testOldArchiveFormatLegacy {
149157 name: kName
150158 imageURL: kFIFEImageURL ];
151159 [NSKeyedArchiver setClassName: @" GIDProfileData" forClass: [GIDProfileDataOld class ]];
152- NSData *data = [NSKeyedArchiver archivedDataWithRootObject: oldProfile];
153- GIDProfileData *profileData = [NSKeyedUnarchiver unarchiveObjectWithData: data];
160+ NSError *archiveError;
161+ NSData *data = [NSKeyedArchiver archivedDataWithRootObject: oldProfile
162+ requiringSecureCoding: NO
163+ error: &archiveError];
164+ XCTAssertNil (archiveError);
165+ NSError *unarchiveError;
166+ GIDProfileData *profileData = [NSKeyedUnarchiver unarchivedObjectOfClass: [GIDProfileData class ]
167+ fromData: data
168+ error: &unarchiveError];
169+ XCTAssertNil (unarchiveError);
154170 XCTAssertEqualObjects (profileData.email , kEmail );
155171 XCTAssertEqualObjects (profileData.name , kName );
156172 XCTAssertNil (profileData.givenName );
0 commit comments