You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GameCenterAuthProvider is currently not defined for watchOS, but its extension targets watchOS, which is causing issues when trying to build Firebase for watchOS.
• The FirebaseAuth library includes GameCenterAuthProvider functionality, but it appears that the core provider itself does not support watchOS.
• However, the GameCenterAuthProvider extension is set to target watchOS, which leads to build errors when the library is used in a watchOS project.
Expected Behavior:
• Either GameCenterAuthProvider should be defined and supported for watchOS, or the extension targeting should exclude watchOS to avoid any conflicts in watchOS builds.
Steps to Reproduce:
1. Add FirebaseAuth as a dependency using SPM in a project with both iOS and watchOS targets.
2. Attempt to build the project for watchOS.
3. Observe the build error related to GameCenterAuthProvider.
Code:
Error Here ::>>
#if canImport(Combine) && swift(>=5.0)
import Combine
import FirebaseAuth
@available(swift 5.0)@available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0,*)@available(watchOS, unavailable)publicextensionGameCenterAuthProvider{ // Error: Cannot find type 'GameCenterAuthProvider' in scope
/// Creates an `AuthCredential` for a Game Center sign in.
///
/// The publisher will emit events on the **main** thread.
///
/// - Returns: A publisher that emits an `AuthCredential` when the credential is obtained
/// successfully, or an error otherwise. The publisher will emit on the *main* thread.
classfunc getCredential()->Future<AuthCredential,Error>{Future<AuthCredential,Error>{ promise inself.getCredential{ authCredential, error iniflet error {promise(.failure(error))}elseiflet authCredential {promise(.success(authCredential))}}}}}#endif // canImport(Combine) && swift(>=5.0)
GameCenterAuthProvider Defined ::>>
#if !os(watchOS)
import Foundation
import GameKit
// TODO: Delete this when minimum iOS version passes 13.5.
/// WarningWorkaround is needed because playerID is deprecated in iOS 13.0 but still needed until
/// 13.5 when the fetchItems API was introduced.
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7,*)privateprotocolWarningWorkaround{staticfunc pre135Credential(localPlayer:GKLocalPlayer,
completion:@escaping(AuthCredential?,Error?)->Void)}@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7,*)extensionGameCenterAuthProvider:WarningWorkaround{}
/// A concrete implementation of `AuthProvider` for Game Center Sign In. Not available on watchOS.
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7,*)@objc(FIRGameCenterAuthProvider)openclassGameCenterAuthProvider:NSObject{
/// A string constant identifying the Game Center identity provider.
@objcpublicstaticletid="gc.apple.com"
/// Creates an `AuthCredential` for a Game Center sign in.
@objcopenclassfunc getCredential(completion:@escaping(AuthCredential?,Error?)->Void){
/**
Linking GameKit.framework without using it on macOS results in App Store rejection.
Thus we don't link GameKit.framework to our SDK directly. `optionalLocalPlayer` is used for
checking whether the APP that consuming our SDK has linked GameKit.framework. If not, a
`GameKitNotLinkedError` will be raised.
**/
guardlet _:AnyClass=NSClassFromString("GKLocalPlayer")else{completion(nil,AuthErrorUtils.gameKitNotLinkedError())return}letlocalPlayer=GKLocalPlayer.local
guard localPlayer.isAuthenticated else{completion(nil,AuthErrorUtils.localPlayerNotAuthenticatedError())return}if #available(iOS 13.5, macOS 10.15.5, macCatalyst 13.5, tvOS 13.4.8,*){
localPlayer.fetchItems{ publicKeyURL, signature, salt, timestamp, error iniflet error = error {completion(nil, error)}else{letcredential=GameCenterAuthCredential(withPlayerID:"",
teamPlayerID: localPlayer.teamPlayerID,
gamePlayerID: localPlayer.gamePlayerID,
publicKeyURL: publicKeyURL,
signature: signature,
salt: salt,
timestamp: timestamp,
displayName: localPlayer.displayName)completion(credential,nil)}}}else{(GameCenterAuthProvider.self asWarningWorkaround.Type).pre135Credential(
localPlayer: localPlayer, completion: completion
)}}@available(iOS, deprecated:13.0)@available(tvOS, deprecated:13.0)@available(macOS, deprecated:10.15.0)@available(macCatalyst, deprecated:13.0)fileprivateclassfunc pre135Credential(localPlayer:GKLocalPlayer,
completion:@escaping(AuthCredential?,Error?)->Void){
localPlayer
.generateIdentityVerificationSignature{ publicKeyURL, signature, salt, timestamp, error inif error !=nil{completion(nil, error)}else{
/**
`localPlayer.alias` is actually the displayname needed, instead of
`localPlayer.displayname`. For more information, check
https://developer.apple.com/documentation/gamekit/gkplayer
**/
letdisplayName= localPlayer.alias
letcredential=GameCenterAuthCredential(withPlayerID: localPlayer.playerID,
teamPlayerID:nil,
gamePlayerID:nil,
publicKeyURL: publicKeyURL,
signature: signature,
salt: salt,
timestamp: timestamp,
displayName: displayName)completion(credential,nil)}}}
/// Creates an `AuthCredential` for a Game Center sign in.
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 8,*)openclassfunc getCredential()asyncthrows->AuthCredential{returntryawaitwithCheckedThrowingContinuation{ continuation ingetCredential{ credential, error iniflet credential = credential {
continuation.resume(returning: credential)}else{
continuation.resume(throwing: error!) // TODO: Change to ?? and generate unknown error
}}}}@available(*, unavailable)@objcoverridepublicinit(){fatalError("This class is not meant to be initialized.")}}@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7,*)@objc(FIRGameCenterAuthCredential)classGameCenterAuthCredential:AuthCredential,NSSecureCoding{letplayerID:StringletteamPlayerID:String?letgamePlayerID:String?letpublicKeyURL:URL?letsignature:Data?letsalt:Data?lettimestamp:UInt64letdisplayName:String
/// - Parameter playerID: The ID of the Game Center local player.
/// - Parameter teamPlayerID: The teamPlayerID of the Game Center local player.
/// - Parameter gamePlayerID: The gamePlayerID of the Game Center local player.
/// - Parameter publicKeyURL: The URL for the public encryption key.
/// - Parameter signature: The verification signature generated.
/// - Parameter salt: A random string used to compute the hash and keep it randomized.
/// - Parameter timestamp: The date and time that the signature was created.
/// - Parameter displayName: The display name of the Game Center player.
init(withPlayerID playerID:String, teamPlayerID:String?, gamePlayerID:String?,
publicKeyURL:URL?, signature:Data?, salt:Data?,
timestamp:UInt64, displayName:String){self.playerID = playerID
self.teamPlayerID = teamPlayerID
self.gamePlayerID = gamePlayerID
self.publicKeyURL = publicKeyURL
self.signature = signature
self.salt = salt
self.timestamp = timestamp
self.displayName = displayName
super.init(provider:GameCenterAuthProvider.id)}
// MARK: Secure Coding
staticvarsupportsSecureCoding=truefunc encode(with coder:NSCoder){
coder.encode(playerID, forKey:"playerID")
coder.encode(teamPlayerID, forKey:"teamPlayerID")
coder.encode(gamePlayerID, forKey:"gamePlayerID")
coder.encode(publicKeyURL, forKey:"publicKeyURL")
coder.encode(signature, forKey:"signature")
coder.encode(salt, forKey:"salt")
coder.encode(timestamp, forKey:"timestamp")
coder.encode(displayName, forKey:"displayName")}requiredinit?(coder:NSCoder){guardlet playerID = coder.decodeObject(of:NSString.self, forKey:"playerID")as?String,let teamPlayerID = coder.decodeObject(
of:NSString.self,
forKey:"teamPlayerID")as?String,let gamePlayerID = coder.decodeObject(
of:NSString.self,
forKey:"gamePlayerID")as?String,let timestamp = coder.decodeObject(of:NSNumber.self, forKey:"timestamp")as?UInt64,let displayName = coder.decodeObject(
of:NSString.self,
forKey:"displayName")as?Stringelse{returnnil}self.playerID = playerID
self.teamPlayerID = teamPlayerID
self.gamePlayerID = gamePlayerID
self.timestamp = timestamp
self.displayName = displayName
publicKeyURL = coder.decodeObject(forKey:"publicKeyURL")as?URL
signature = coder.decodeObject(of:NSData.self, forKey:"signature")as?Data
salt = coder.decodeObject(of:NSData.self, forKey:"salt")as?Data
super.init(provider:GameCenterAuthProvider.id)}}#endif
Reproducing the issue
No response
Firebase SDK Version
11.4
Xcode Version
15.2
Installation Method
Swift Package Manager
Firebase Product(s)
Authentication
Targeted Platforms
iOS, watchOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
The text was updated successfully, but these errors were encountered:
Description
Xcode Version: 15.2
Minimum Target(iOS): 16.1
Minimun Target(watchOS): 9.0
The GameCenterAuthProvider is currently not defined for watchOS, but its extension targets watchOS, which is causing issues when trying to build Firebase for watchOS.
Temporary Workaround:
install Firebase 10.29.0 Version.
Problem:
Expected Behavior:
Steps to Reproduce:
Code:
Reproducing the issue
No response
Firebase SDK Version
11.4
Xcode Version
15.2
Installation Method
Swift Package Manager
Firebase Product(s)
Authentication
Targeted Platforms
iOS, watchOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippetReplace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippetReplace this line with the contents of your Podfile.lock!
The text was updated successfully, but these errors were encountered: