Skip to content

Commit c148216

Browse files
authored
Fix import bug (#9624)
* Fix import bug * add test * make test better
1 parent 15578ee commit c148216

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

FirebaseAuth/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v9.0.0
2+
- [fixed] **Breaking change:** Fixed an ObjC-to-Swift API conversion error where `getStoredUser(forAccessGroup:)` returned a non-optional type. This change is breaking for Swift users only (#8599).
3+
14
# v8.14.0
25
- [added] Started to collect the Firebase user agent for Firebase Auth. (#9066)
36

FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuth.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ NS_SWIFT_NAME(Auth)
866866
Please refer to https://github.com/firebase/firebase-ios-sdk/issues/8878 for details.
867867
*/
868868
- (nullable FIRUser *)getStoredUserForAccessGroup:(NSString *_Nullable)accessGroup
869-
error:(NSError *_Nullable *_Nullable)outError;
869+
error:(NSError *_Nullable *_Nullable)outError
870+
__attribute__((swift_error(nonnull_error))); // This method can return `nil` on success.
870871

871872
@end
872873

FirebaseAuth/Tests/Sample/SwiftApiTests/SwiftAPI.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ class AuthAPI_hOnlyTests: XCTestCase {
8787
auth.setAPNSToken(Data(), type: AuthAPNSTokenType(rawValue: 2)!)
8888
auth.canHandleNotification([:])
8989
try auth.useUserAccessGroup("abc")
90-
try auth.getStoredUser(forAccessGroup: "def")
90+
let nilUser = try auth.getStoredUser(forAccessGroup: "def")
91+
// If nilUser is not optional, this will raise a compiler error.
92+
// This condition does not need to execute, and may not if prior
93+
// functions throw.
94+
if let value = nilUser {
95+
XCTAssert(true)
96+
}
9197
}
9298

9399
#if compiler(>=5.5.2) && canImport(_Concurrency)

0 commit comments

Comments
 (0)