In Version 4.0.0 des Firebase iOS SDK für Swift haben wir Änderungen vorgenommen, um die Namenskonventionen in den Swift API-Designrichtlinien Um Fehler oder Warnungen zu beheben, die beim Aktualisieren der App Version des Firebase iOS SDK verwenden, folgen Sie den Schritten in dieser Migrationsanleitung.
Änderungen in der neuen Version
Die folgenden Änderungen am Swift SDK wurden in allen Firebase-Produkten vorgenommen:
- Das Präfix
FIR
aus den Namen aller Konstanten, Protokolle, Klassen Enums und Typdefinitionen. - „
FIRApp
“ wird in „FirebaseApp
“ umbenannt. - „
FIROptions
“ wird in „FirebaseOptions
“ umbenannt.
Eine vollständige Liste der Änderungen finden Sie in der detaillierten Liste der Änderungen.
Fehler beheben.
Fehler, die aus diesen Änderungen resultieren, können am besten mit der Funktion „Korrektur in Xcode ändern.
- Wenn Sie Ihr aktualisiertes Projekt in Ihrem Xcode-Arbeitsbereich öffnen, werden Fehler der Namensänderungen werden in der Problemnavigation angezeigt.
- Klicken Sie auf den Fehler und beheben Sie ihn mit dem Vorschlag im Dialogfeld „Problem beheben“.
Namenskonflikte lösen
Verwenden Sie den vom Modul bereitgestellten Namespace, um Namenskonflikte zu lösen. Für
Im Fall von FIRUser
, das jetzt User
ist, möchten Sie vielleicht
zwischen der Klasse User
und der Firebase User
-Klasse zu unterscheiden.
@import Firebase ... var firebaseUser: Firebase.User?
Detaillierte Liste der Änderungen
Analytics
Zurück | Neu |
---|---|
Funktionen | |
FIRAnalytics | |
logEvent(withName:parameters:) |
logEvent(_:parameters:) |
Vorherige Verwendung:
FIRAnalytics.logEvent(withName: "com.myapp.appStart", parameters: nil) Analytics.logEvent("com.myapp.appStart", parameters: nil) | |
setUserPropertyString(_:forName:) | setUserProperty(_:forName:) |
Bisherige Nutzung:
FIRAnalytics.setUserPropertyString("mechanic", forName: "job") Analytics.setUserProperty("mechanic", forName: "job") | |
Klassen | |
FIRAnalytics | Analytics |
Konstanten | |
FIRAnalyticsEventAddPaymentInfo | AnalyticsEventAddPaymentInfo |
FIRAnalyticsEventAddToCart | AnalyticsEventAddToCart |
FIRAnalyticsEventAddToWishlist | AnalyticsEventAddToWishlist |
FIRAnalyticsEventAppOpen | AnalyticsEventAppOpen |
FIRAnalyticsEventBeginCheckout | AnalyticsEventBeginCheckout |
FIRAnalyticsEventCampaignDetails | AnalyticsEventCampaignDetails |
FIRAnalyticsEventCheckoutProgress | AnalyticsEventCheckoutProgress |
FIRAnalyticsEventEarnVirtualCurrency | AnalyticsEventEarnVirtualCurrency |
FIRAnalyticsEventEcommercePurchase | AnalyticsEventEcommercePurchase |
FIRAnalyticsEventGenerateLead | AnalyticsEventGenerateLead |
FIRAnalyticsEventJoinGroup | AnalyticsEventJoinGroup |
FIRAnalyticsEventLevelUp | AnalyticsEventLevelUp |
FIRAnalyticsEventLogin | AnalyticsEventLogin |
FIRAnalyticsEventPostScore | AnalyticsEventPostScore |
FIRAnalyticsEventPresentOffer | AnalyticsEventPresentOffer |
FIRAnalyticsEventPurchaseRefund | AnalyticsEventPurchaseRefund |
FIRAnalyticsEventRemoveFromCart | AnalyticsEventRemoveFromCart |
FIRAnalyticsEventSearch | AnalyticsEventSearch |
FIRAnalyticsEventSelectContent | AnalyticsEventSelectContent |
FIRAnalyticsEventSetCheckoutOption | AnalyticsEventSetCheckoutOption |
FIRAnalyticsEventShare | AnalyticsEventShare |
FIRAnalyticsEventSignUp | AnalyticsEventSignUp |
FIRAnalyticsEventSpendVirtualCurrency | AnalyticsEventSpendVirtualCurrency |
FIRAnalyticsEventTutorialBegin | AnalyticsEventTutorialBegin |
FIRAnalyticsEventTutorialComplete | AnalyticsEventTutorialComplete |
FIRAnalyticsEventUnlockAchievement | AnalyticsEventUnlockAchievement |
FIRAnalyticsEventViewItem | AnalyticsEventViewItem |
FIRAnalyticsEventViewItemList | AnalyticsEventViewItemList |
FIRAnalyticsEventViewSearchResults | AnalyticsEventViewSearchResults |
FIRAnalyticsParameterAchievementID | AnalyticsParameterAchievementID |
FIRAnalyticsParameterAdNetworkClickID | AnalyticsParameterAdNetworkClickID |
FIRAnalyticsParameterAffiliation | AnalyticsParameterAffiliation |
FIRAnalyticsParameterCampaign | AnalyticsParameterCampaign |
FIRAnalyticsParameterCharacter | AnalyticsParameterCharacter |
FIRAnalyticsParameterCheckoutStep | AnalyticsParameterCheckoutStep |
FIRAnalyticsParameterCheckoutOption | AnalyticsParameterCheckoutOption |
FIRAnalyticsParameterContent | AnalyticsParameterContent |
FIRAnalyticsParameterContentType | AnalyticsParameterContentType |
FIRAnalyticsParameterCoupon | AnalyticsParameterCoupon |
FIRAnalyticsParameterCreativeName | AnalyticsParameterCreativeName |
FIRAnalyticsParameterCreativeSlot | AnalyticsParameterCreativeSlot |
FIRAnalyticsParameterCurrency | AnalyticsParameterCurrency |
FIRAnalyticsParameterDestination | AnalyticsParameterDestination |
FIRAnalyticsParameterEndDate | AnalyticsParameterEndDate |
FIRAnalyticsParameterFlightNumber | AnalyticsParameterFlightNumber |
FIRAnalyticsParameterGroupID | AnalyticsParameterGroupID |
FIRAnalyticsParameterIndex | AnalyticsParameterIndex |
FIRAnalyticsParameterItemBrand | AnalyticsParameterItemBrand |
FIRAnalyticsParameterItemCategory | AnalyticsParameterItemCategory |
FIRAnalyticsParameterItemID | AnalyticsParameterItemID |
FIRAnalyticsParameterItemLocationID | AnalyticsParameterItemLocationID |
FIRAnalyticsParameterItemName | AnalyticsParameterItemName |
FIRAnalyticsParameterItemList | AnalyticsParameterItemList |
FIRAnalyticsParameterItemVariant | AnalyticsParameterItemVariant |
FIRAnalyticsParameterLevel | AnalyticsParameterLevel |
FIRAnalyticsParameterLocation | AnalyticsParameterLocation |
FIRAnalyticsParameterMedium | AnalyticsParameterMedium |
FIRAnalyticsParameterNumberOfNights | AnalyticsParameterNumberOfNights |
FIRAnalyticsParameterNumberOfPassengers | AnalyticsParameterNumberOfPassengers |
FIRAnalyticsParameterNumberOfRooms | AnalyticsParameterNumberOfRooms |
FIRAnalyticsParameterOrigin | AnalyticsParameterOrigin |
FIRAnalyticsParameterPrice | AnalyticsParameterPrice |
FIRAnalyticsParameterQuantity | AnalyticsParameterQuantity |
FIRAnalyticsParameterScore | AnalyticsParameterScore |
FIRAnalyticsParameterSearchTerm | AnalyticsParameterSearchTerm |
FIRAnalyticsParameterShipping | AnalyticsParameterShipping |
FIRAnalyticsParameterSignUpMethod | AnalyticsParameterSignUpMethod |
FIRAnalyticsParameterSource | AnalyticsParameterSource |
FIRAnalyticsParameterStartDate | AnalyticsParameterStartDate |
FIRAnalyticsParameterTax | AnalyticsParameterTax |
FIRAnalyticsParameterTerm | AnalyticsParameterTerm |
FIRAnalyticsParameterTransactionID | AnalyticsParameterTransactionID |
FIRAnalyticsParameterTravelClass | AnalyticsParameterTravelClass |
FIRAnalyticsParameterValue | AnalyticsParameterValue |
FIRAnalyticsParameterVirtualCurrencyName | AnalyticsParameterVirtualCurrencyName |
FIRAnalyticsUserPropertySignUpMethod | AnalyticsUserPropertySignUpMethod |
Auth
Zurück | Neu |
---|---|
Funktionen | |
FIRAuth.h | |
init?(app:) | auth(app:) |
Bisherige Nutzung:
let auth = FIRAuth(app: myApp) let auth = Auth.auth(app: myApp) | |
FIRUser.h | |
updateEmail(_:completion:) | updateEmail(to:completion:) |
Bisherige Nutzung:
user.updateEmail("firebase_rox42@gmail.com") { error in // Check for error } user.updateEmail(to: "firebase_rox42@gmail.com") { error in // Check for error } | |
updatePassword(_:completion:) |
updatePassword(to:completion:) |
Bisherige Nutzung:
user.updatePassword("hunter2") { error in // Check for error } user.updatePassword(to: "hunter2") { error in // Check for error } | |
profileChangeRequest() |
createProfileChangeRequest() |
Vorherige Verwendung:
let request = user.profileChangeRequest() let request = user.createProfileChangeRequest() | |
getTokenWithCompletion(_:) |
getToken(completion:) |
Vorherige Verwendung:
user.getTokenWithCompletion() { token, error in // Handle token or error here } user.getToken() { token, error in // Handle token or error here } | |
Klassen | |
FIRAdditionalUserInfo | AdditionalUserInfo |
FIRActionCodeInfo | ActionCodeInfo |
FIRAuth | Auth |
FIRAuthCredential | AuthCredential |
FIRAuthDataResult | AuthDataResult |
FIRAuthErrors | AuthErrors |
FIRSecureTokenService | SecureTokenService |
FIRUser | User |
FIRUserProfileChangeRequest | UserProfileChangeRequest |
FIRUserInfo | UserInfo |
FIREmailAuthProvider | EmailAuthProvider |
FIRFacebookAuthProvider | FacebookAuthProvider |
FIRGitHubAuthProvider | GitHubAuthProvider |
FIRGoogleAuthProvider | GoogleAuthProvider |
FIROAuthProvider | OAuthProvider |
FIRTwitterAuthProvider | TwitterAuthProvider |
Konstanten | |
FIRAuthErrorDomain | AuthErrorDomain |
FIRAuthErrorNameKey | AuthErrorNameKey |
FIREmailAuthProviderID | EmailAuthProviderID |
FIRFacebookAuthProviderID | FacebookAuthProviderID |
FIRGitHubAuthProviderID | GitHubAuthProviderID |
FIRGoogleAuthProviderID | GoogleAuthProviderID |
FIRTwitterAuthProviderID | TwitterAuthProviderID |
FIRAuthStateDidChange | AuthStateDidChange |
Typdeklarationen | |
FIRAuthStateDidChangeListenerHandle | AuthStateDidChangeListenerHandle |
FIRAuthStateDidChangeListenerBlock | AuthStateDidChangeListenerBlock |
FIRAuthDataResultCallback | AuthDataResultCallback |
FIRAuthResultCallback | AuthResultCallback |
FIRProviderQueryCallback | ProviderQueryCallback |
FIRSendPasswordResetCallback | SendPasswordResetCallback |
FIRConfirmPasswordResetCallback | ConfirmPasswordResetCallback |
FIRVerifyPasswordResetCodeCallback | VerifyPasswordResetCodeCallback |
FIRApplyActionCodeCallback | ApplyActionCodeCallback |
FIRVerificationResultCallback | VerificationResultCallback |
Enums | |
FIRActionDataKey | ActionDataKey |
FIRActionCodeOperation | ActionCodeOperation |
FIRAuthErrorCode | AuthErrorCode |
Kernprodukt
Zurück | Neu |
---|---|
Funktionen | |
FIRAnalyticsConfiguration.sharedInstance() | AnalyticsConfiguration.shared() |
FIRApp.configure(withName:options:) |
FirebaseApp.configure(name:options:) |
Bisherige Nutzung:
FIRApp.configure(withName: "myCustomApp", options: customOptions) FirebaseApp.configure(name: "myCustomApp", options: customOptions) | |
FIRApp.defaultApp() |
FirebaseApp.app() |
FIRApp.init?(named:) |
FirebaseApp.app(name:) |
Bisherige Nutzung:
let app = FIRApp(named: "myCustomApp") let app = FirebaseApp.app(name: "myCustomApp") | |
FIRApp.allApps() |
FirebaseApp.allApps |
Bisherige Nutzung:
for app in FIRApp.allApps() { print("App name: \(app.name)") } for app in FirebaseApp.allApps { print("App name: \(app.name)") } | |
FIRConfiguration.sharedInstance() | FirebaseConfiguration.shared() |
FIROptions.default() | FirebaseOptions.defaultOptions() |
Attribute | |
FIR-Optionen | |
GCMSenderID | gcmSenderID |
Klassen | |
FIRAnalyticsConfiguration | AnalyticsConfiguration |
FIRApp | FirebaseApp |
FIRConfiguration | FirebaseConfiguration |
FIROptions | FirebaseOptions |
Typdeklarationen | |
FIRAppVoidBoolCallback | FirebaseAppVoidBoolCallback |
Enums | |
FIRLoggerLevel | FirebaseLoggerLevel |
Absturz
Zurück | Neu |
---|---|
Funktionen | |
FIRCrashMessage(_:) |
FirebaseCrashMessage(_:) |
Datenbank
Zurück | Neu |
---|---|
Attribute | |
FIRDatabase.h | |
persistenceEnabled | isPersistenceEnabled |
Klassen | |
FIRDataSnapshot | DataSnapshot |
FIRDatabase | Database |
FIRDatabaseQuery | DatabaseQuery |
FIRDatabaseReference | DatabaseReference |
FIRMutableData | MutableData |
FIRServerValue | ServerValue |
FIRTransactionResult | TransactionResult |
Typdeklarationen | |
FIRDatabaseHandle | DatabaseHandle |
Enums | |
FIRDataEventType | DataEventType |
Dynamic Links
Zurück | Neu |
---|---|
Funktionen | |
// FIRDynamicLinks.h | |
dynamicLink(fromUniversalLinkURL:) | dynamicLink(fromUniversalLink:) |
Klassen | |
FIRDynamicLink | DynamicLink |
FIRDLRetrievalDelegate | DLRetrievalDelegate |
FIRDynamicLinks | DynamicLinks |
FIRDynamicLinkGoogleAnalyticsParameters | DynamicLinkGoogleAnalyticsParameters |
FIRDynamicLinkIOSParameters | DynamicLinkIOSParameters |
FIRDynamicLinkItunesConnectAnalyticsParameters | DynamicLinkItunesConnectAnalyticsParameters |
FIRDynamicLinkAndroidParameters | DynamicLinkAndroidParameters |
FIRDynamicLinkSocialMetaTagParameters | DynamicLinkSocialMetaTagParameters |
FIRDynamicLinkNavigationInfoParameters | DynamicLinkNavigationInfoParameters |
FIRDynamicLinkComponentsOptions | DynamicLinkComponentsOptions |
FIRDynamicLinkComponents | DynamicLinkComponents |
Typdeklarationen | |
FIRDynamicLinkResolverHandler | DynamicLinkResolverHandler |
FIRDynamicLinkUniversalLinkHandler | DynamicLinkUniversalLinkHandler |
FIRDynamicLinkShortenerCompletion | DynamicLinkShortenerCompletion |
Enums | |
FIRDynamicLinkMatchConfidence | DynamicLinkMatchConfidence |
FIRDLRequiredMatchConfidence | DLRequiredMatchConfidence |
FIRDLRetrieveResult | DLRetrieveResult |
FIRShortDynamicLinkPathLength | ShortDynamicLinkPathLength |
Instanz-ID
Zurück | Neu |
---|---|
Funktionen | |
FIRInstanceID.h | |
getWithHandler() |
getIDWithHandler() |
Bisherige Nutzung:
FIRInstanceID.instanceID().get { identity, error in // Check identity and error } instanceID.instanceID().getID { identity, error in // Check identity and error } | |
deleteWithHandler() |
deleteIDWithHandler() |
Bisherige Nutzung:
FIRInstanceID.instanceID().delete { error in // Check error } instanceID.instanceID().deleteID { error in // Check error } | |
Klassen | |
FIRInstanceID | InstanceID |
Konstanten | |
FIRInstanceIDScopeFirebaseMessaging | InstanceIDScopeFirebaseMessaging |
FIRInstanceIDTokenRefresh | InstanceIDTokenRefresh |
Typdeklarationen | |
FIRInstanceIDTokenHandler | InstanceIDTokenHandler |
FIRInstanceIDDeleteTokenHandler | InstanceIDDeleteTokenHandler |
FIRInstanceIDHandler | InstanceIDHandler |
FIRInstanceIDDeleteHandler | InstanceIDDeleteHandler |
Enums | |
FIRInstanceIDError | InstanceIDError |
FIRInstanceIDAPNSTokenType | InstanceIDAPNSTokenType |
Einladungen
Zurück | Neu |
---|---|
Klassen | |
FIRInvites | Invites |
FIRInvitesTargetApplication | InvitesTargetApplication |
FIRReceivedInvite | ReceivedInvite |
Konstanten | |
FIRInvitesErrorDomain | InvitesErrorDomain |
Enums | |
FIRInvitesErrorCode | InvitesErrorCode |
FIRReceivedInviteMatchType | ReceivedInviteMatchType |
Protokolle | |
FIRInviteBuilder | InviteBuilder |
FIRInviteDelegate | InviteDelegate |
Messaging
Zurück | Neu |
---|---|
Funktionen | |
FIRMessaging | |
connect(completion:) | connect(handler:) |
Klassen | |
FIRMessagingMessageInfo | MessagingMessageInfo |
FIRMessagingRemoteMessage | MessagingRemoteMessage |
FIRMessaging | Messaging |
Konstanten | |
FIRMessagingSendSuccess | MessagingSendSuccess |
FIRMessagingSendError | MessagingSendError |
FIRMessagingMessagesDeleted | MessagingMessagesDeleted |
FIRMessagingConnectionStateChanged | MessagingConnectionStateChanged |
FIRMessagingRegistrationTokenRefreshed | MessagingRegistrationTokenRefreshed |
Typdeklarationen | |
FIRMessagingFCMTokenFetchCompletion | MessagingFCMTokenFetchCompletion |
FIRMessagingDeleteFCMTokenCompletion | MessagingDeleteFCMTokenCompletion |
Enums | |
FIRMessagingError | MessagingError |
FIRMessagingMessageStatus | MessagingMessageStatus |
FIRMessagingAPNSTokenType | MessagingAPNSTokenType |
Protokolle | |
FIRMessagingDelegate | MessagingDelegate |
Remote Config
Zurück | Neu |
---|---|
Funktionen | |
FIRRemoteConfig | |
setDefaultsFromPlistFileName(_:) | setDefaults(fromPlist:) |
setDefaultsFromPlistFileName(_:namespace) | setDefaults(fromPlist:namespace) |
Klassen | |
FIRRemoteConfigValue | RemoteConfigValue |
FIRRemoteConfigSettings | RemoteConfigSettings |
FIRRemoteConfig | RemoteConfig |
Konstanten | |
FIRNamespaceGoogleMobilePlatform | NamespaceGoogleMobilePlatform |
FIRRemoteConfigThrottledEndTimeInSecondsKey | RemoteConfigThrottledEndTimeInSecondsKey |
FIRRemoteConfigErrorDomain | RemoteConfigErrorDomain |
Typdeklarationen | |
FIRRemoteConfigFetchCompletion | RemoteConfigFetchCompletion |
Enums | |
FIRRemoteConfigFetchStatus | RemoteConfigFetchStatus |
FIRRemoteConfigError | RemoteConfigError |
FIRRemoteConfigSource | RemoteConfigSource |
Speicher
Zurück | Neu |
---|---|
Funktionen | |
FIRStorage-Referenz | |
put(_:) | putData(_:) |
put(_:metadata:) | putData(_:metadata:) |
put(_:metadata:completion:) | putData(_:metadata:completion:) |
putFile(_:) | putFile(from:) |
putFile(_:metadata:) | putFile(from:metadata:) |
putFile(_:metadata:completion:) | putFile(from:metadata:completion:) |
data(withMaxSize:completion:) | getData(maxSize:completion:) |
metadata(completion:) | getMetadata(completion:) |
update(_:completion:) | updateMetadata(_:completion:) |
Klassen | |
FIRStorage | Storage |
FIRStorageDownloadTask | StorageDownloadTask |
FIRStorageMetadata | StorageMetadata |
FIRStorageObservableTask | StorageObservableTask |
FIRStorageReference | StorageReference |
FIRStorageTask | StorageTask |
FIRStorageTaskSnapshot | StorageTaskSnapshot |
FIRStorageUploadTask | StorageUploadTask |
Konstanten | |
FIRStorageErrorDomain | StorageErrorDomain |
Enums | |
FIRStorageTaskStatus | StorageTaskStatus |
FIRStorageErrorCode | StorageErrorCode |
Protokolle | |
FIRStorageTaskManagement | StorageTaskManagement |
Typdeklarationen | |
FIRStorageHandle | StorageHandle |
FIRStorageVoidDataError | StorageVoidDataError |
FIRStorageVoidError | StorageVoidError |
FIRStorageVoidMetadata | StorageVoidMetadata |
FIRStorageVoidMetadataError | StorageVoidMetadataError |
FIRStorageVoidSnapshot | StorageVoidSnapshot |
FIRStorageVoidURLError | StorageVoidURLError |