Nella versione 4.0.0 dell'SDK Firebase per iOS per Swift, abbiamo incluso modifiche per rispettare le convenzioni di denominazione riportate nelle linee guida per la progettazione di API Swift. Per correggere eventuali errori o avvisi che potresti ricevere quando aggiorni l'app dell'SDK Firebase per iOS, segui i passaggi descritti in questa guida alla migrazione.
Modifiche nella nuova versione
Sono state apportate le seguenti modifiche all'SDK Swift in tutti i prodotti Firebase:
- Rimozione del prefisso
FIR
tra i nomi per tutte le costanti, i protocolli, le classi enum e definizioni dei tipi. - Ridenominazione di
FIRApp
inFirebaseApp
in corso... FIROptions
è stato rinominato inFirebaseOptions
.
Per un elenco completo delle modifiche, consulta la sezione con l'elenco dettagliato delle modifiche.
Risolvi gli errori
Il modo migliore per risolvere gli errori derivanti da queste modifiche è utilizzare in Xcode.
- Quando apri il progetto aggiornato nell'area di lavoro Xcode, gli errori delle modifiche di denominazione vengono visualizzate nella barra di navigazione dei problemi.
- Fai clic sull'errore e correggilo con il suggerimento nella Finestra di dialogo Risolvi.
Risolvi i conflitti di denominazione
Per risolvere i conflitti di denominazione, utilizza lo spazio dei nomi fornito dal modulo. Per
Ad esempio, nel caso di FIRUser
, che ora è User
, potresti voler
differenzia tra la tua classe/struttura User
e la classe Firebase User
.
@import Firebase ... var firebaseUser: Firebase.User?
Elenco dettagliato delle modifiche
Analytics
Indietro | Nuovo |
---|---|
Functions | |
FIRAnalytics | |
logEvent(withName:parameters:) |
logEvent(_:parameters:) |
Utilizzo precedente:
FIRAnalytics.logEvent(withName: "com.myapp.appStart", parameters: nil) Analytics.logEvent("com.myapp.appStart", parameters: nil) | |
setUserPropertyString(_:forName:) | setUserProperty(_:forName:) |
Utilizzo precedente:
FIRAnalytics.setUserPropertyString("mechanic", forName: "job") Analytics.setUserProperty("mechanic", forName: "job") | |
Corsi | |
FIRAnalytics | Analytics |
Costanti | |
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
Indietro | Nuovo |
---|---|
Functions | |
FIRAuth.h | |
init?(app:) | auth(app:) |
Utilizzo precedente:
let auth = FIRAuth(app: myApp) let auth = Auth.auth(app: myApp) | |
FIRUser.h | |
updateEmail(_:completion:) | updateEmail(to:completion:) |
Utilizzo precedente:
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:) |
Utilizzo precedente:
user.updatePassword("hunter2") { error in // Check for error } user.updatePassword(to: "hunter2") { error in // Check for error } | |
profileChangeRequest() |
createProfileChangeRequest() |
Utilizzo precedente:
let request = user.profileChangeRequest() let request = user.createProfileChangeRequest() | |
getTokenWithCompletion(_:) |
getToken(completion:) |
Utilizzo precedente:
user.getTokenWithCompletion() { token, error in // Handle token or error here } user.getToken() { token, error in // Handle token or error here } | |
Corsi | |
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 |
Costanti | |
FIRAuthErrorDomain | AuthErrorDomain |
FIRAuthErrorNameKey | AuthErrorNameKey |
FIREmailAuthProviderID | EmailAuthProviderID |
FIRFacebookAuthProviderID | FacebookAuthProviderID |
FIRGitHubAuthProviderID | GitHubAuthProviderID |
FIRGoogleAuthProviderID | GoogleAuthProviderID |
FIRTwitterAuthProviderID | TwitterAuthProviderID |
FIRAuthStateDidChange | AuthStateDidChange |
Dichiarazioni dei tipi | |
FIRAuthStateDidChangeListenerHandle | AuthStateDidChangeListenerHandle |
FIRAuthStateDidChangeListenerBlock | AuthStateDidChangeListenerBlock |
FIRAuthDataResultCallback | AuthDataResultCallback |
FIRAuthResultCallback | AuthResultCallback |
FIRProviderQueryCallback | ProviderQueryCallback |
FIRSendPasswordResetCallback | SendPasswordResetCallback |
FIRConfirmPasswordResetCallback | ConfirmPasswordResetCallback |
FIRVerifyPasswordResetCodeCallback | VerifyPasswordResetCodeCallback |
FIRApplyActionCodeCallback | ApplyActionCodeCallback |
FIRVerificationResultCallback | VerificationResultCallback |
Enum | |
FIRActionDataKey | ActionDataKey |
FIRActionCodeOperation | ActionCodeOperation |
FIRAuthErrorCode | AuthErrorCode |
Nucleo
Indietro | Nuovo |
---|---|
Functions | |
FIRAnalyticsConfiguration.sharedInstance() | AnalyticsConfiguration.shared() |
FIRApp.configure(withName:options:) |
FirebaseApp.configure(name:options:) |
Utilizzo precedente:
FIRApp.configure(withName: "myCustomApp", options: customOptions) FirebaseApp.configure(name: "myCustomApp", options: customOptions) | |
FIRApp.defaultApp() |
FirebaseApp.app() |
FIRApp.init?(named:) |
FirebaseApp.app(name:) |
Utilizzo precedente:
let app = FIRApp(named: "myCustomApp") let app = FirebaseApp.app(name: "myCustomApp") | |
FIRApp.allApps() |
FirebaseApp.allApps |
Utilizzo precedente:
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() |
Proprietà | |
Opzioni APRI | |
GCMSenderID | gcmSenderID |
Corsi | |
FIRAnalyticsConfiguration | AnalyticsConfiguration |
FIRApp | FirebaseApp |
FIRConfiguration | FirebaseConfiguration |
FIROptions | FirebaseOptions |
Dichiarazioni dei tipi | |
FIRAppVoidBoolCallback | FirebaseAppVoidBoolCallback |
Enum | |
FIRLoggerLevel | FirebaseLoggerLevel |
Arresto anomalo
Indietro | Nuovo |
---|---|
Functions | |
FIRCrashMessage(_:) |
FirebaseCrashMessage(_:) |
Database
Indietro | Nuovo |
---|---|
Proprietà | |
FIRDatabase.h | |
persistenceEnabled | isPersistenceEnabled |
Corsi | |
FIRDataSnapshot | DataSnapshot |
FIRDatabase | Database |
FIRDatabaseQuery | DatabaseQuery |
FIRDatabaseReference | DatabaseReference |
FIRMutableData | MutableData |
FIRServerValue | ServerValue |
FIRTransactionResult | TransactionResult |
Dichiarazioni dei tipi | |
FIRDatabaseHandle | DatabaseHandle |
Enum | |
FIRDataEventType | DataEventType |
Dynamic Links
Indietro | Nuovo |
---|---|
Functions | |
// FIRDynamicLinks.h | |
dynamicLink(fromUniversalLinkURL:) | dynamicLink(fromUniversalLink:) |
Corsi | |
FIRDynamicLink | DynamicLink |
FIRDLRetrievalDelegate | DLRetrievalDelegate |
FIRDynamicLinks | DynamicLinks |
FIRDynamicLinkGoogleAnalyticsParameters | DynamicLinkGoogleAnalyticsParameters |
FIRDynamicLinkIOSParameters | DynamicLinkIOSParameters |
FIRDynamicLinkItunesConnectAnalyticsParameters | DynamicLinkItunesConnectAnalyticsParameters |
FIRDynamicLinkAndroidParameters | DynamicLinkAndroidParameters |
FIRDynamicLinkSocialMetaTagParameters | DynamicLinkSocialMetaTagParameters |
FIRDynamicLinkNavigationInfoParameters | DynamicLinkNavigationInfoParameters |
FIRDynamicLinkComponentsOptions | DynamicLinkComponentsOptions |
FIRDynamicLinkComponents | DynamicLinkComponents |
Dichiarazioni dei tipi | |
FIRDynamicLinkResolverHandler | DynamicLinkResolverHandler |
FIRDynamicLinkUniversalLinkHandler | DynamicLinkUniversalLinkHandler |
FIRDynamicLinkShortenerCompletion | DynamicLinkShortenerCompletion |
Enum | |
FIRDynamicLinkMatchConfidence | DynamicLinkMatchConfidence |
FIRDLRequiredMatchConfidence | DLRequiredMatchConfidence |
FIRDLRetrieveResult | DLRetrieveResult |
FIRShortDynamicLinkPathLength | ShortDynamicLinkPathLength |
ID istanza
Indietro | Nuovo |
---|---|
Functions | |
FIRInstanceID.h | |
getWithHandler() |
getIDWithHandler() |
Utilizzo precedente:
FIRInstanceID.instanceID().get { identity, error in // Check identity and error } instanceID.instanceID().getID { identity, error in // Check identity and error } | |
deleteWithHandler() |
deleteIDWithHandler() |
Utilizzo precedente:
FIRInstanceID.instanceID().delete { error in // Check error } instanceID.instanceID().deleteID { error in // Check error } | |
Corsi | |
FIRInstanceID | InstanceID |
Costanti | |
FIRInstanceIDScopeFirebaseMessaging | InstanceIDScopeFirebaseMessaging |
FIRInstanceIDTokenRefresh | InstanceIDTokenRefresh |
Dichiarazioni dei tipi | |
FIRInstanceIDTokenHandler | InstanceIDTokenHandler |
FIRInstanceIDDeleteTokenHandler | InstanceIDDeleteTokenHandler |
FIRInstanceIDHandler | InstanceIDHandler |
FIRInstanceIDDeleteHandler | InstanceIDDeleteHandler |
Enum | |
FIRInstanceIDError | InstanceIDError |
FIRInstanceIDAPNSTokenType | InstanceIDAPNSTokenType |
Inviti
Indietro | Nuovo |
---|---|
Corsi | |
FIRInvites | Invites |
FIRInvitesTargetApplication | InvitesTargetApplication |
FIRReceivedInvite | ReceivedInvite |
Costanti | |
FIRInvitesErrorDomain | InvitesErrorDomain |
Enum | |
FIRInvitesErrorCode | InvitesErrorCode |
FIRReceivedInviteMatchType | ReceivedInviteMatchType |
Protocolli | |
FIRInviteBuilder | InviteBuilder |
FIRInviteDelegate | InviteDelegate |
Messaggistica
Indietro | Nuovo |
---|---|
Functions | |
FIRMessaging | |
connect(completion:) | connect(handler:) |
Corsi | |
FIRMessagingMessageInfo | MessagingMessageInfo |
FIRMessagingRemoteMessage | MessagingRemoteMessage |
FIRMessaging | Messaging |
Costanti | |
FIRMessagingSendSuccess | MessagingSendSuccess |
FIRMessagingSendError | MessagingSendError |
FIRMessagingMessagesDeleted | MessagingMessagesDeleted |
FIRMessagingConnectionStateChanged | MessagingConnectionStateChanged |
FIRMessagingRegistrationTokenRefreshed | MessagingRegistrationTokenRefreshed |
Dichiarazioni dei tipi | |
FIRMessagingFCMTokenFetchCompletion | MessagingFCMTokenFetchCompletion |
FIRMessagingDeleteFCMTokenCompletion | MessagingDeleteFCMTokenCompletion |
Enum | |
FIRMessagingError | MessagingError |
FIRMessagingMessageStatus | MessagingMessageStatus |
FIRMessagingAPNSTokenType | MessagingAPNSTokenType |
Protocolli | |
FIRMessagingDelegate | MessagingDelegate |
Remote Config
Indietro | Nuovo |
---|---|
Functions | |
FIRRemoteConfig | |
setDefaultsFromPlistFileName(_:) | setDefaults(fromPlist:) |
setDefaultsFromPlistFileName(_:namespace) | setDefaults(fromPlist:namespace) |
Corsi | |
FIRRemoteConfigValue | RemoteConfigValue |
FIRRemoteConfigSettings | RemoteConfigSettings |
FIRRemoteConfig | RemoteConfig |
Costanti | |
FIRNamespaceGoogleMobilePlatform | NamespaceGoogleMobilePlatform |
FIRRemoteConfigThrottledEndTimeInSecondsKey | RemoteConfigThrottledEndTimeInSecondsKey |
FIRRemoteConfigErrorDomain | RemoteConfigErrorDomain |
Dichiarazioni dei tipi | |
FIRRemoteConfigFetchCompletion | RemoteConfigFetchCompletion |
Enum | |
FIRRemoteConfigFetchStatus | RemoteConfigFetchStatus |
FIRRemoteConfigError | RemoteConfigError |
FIRRemoteConfigSource | RemoteConfigSource |
Archiviazione
Indietro | Nuovo |
---|---|
Functions | |
Riferimento FIRStorage | |
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:) |
Corsi | |
FIRStorage | Storage |
FIRStorageDownloadTask | StorageDownloadTask |
FIRStorageMetadata | StorageMetadata |
FIRStorageObservableTask | StorageObservableTask |
FIRStorageReference | StorageReference |
FIRStorageTask | StorageTask |
FIRStorageTaskSnapshot | StorageTaskSnapshot |
FIRStorageUploadTask | StorageUploadTask |
Costanti | |
FIRStorageErrorDomain | StorageErrorDomain |
Enum | |
FIRStorageTaskStatus | StorageTaskStatus |
FIRStorageErrorCode | StorageErrorCode |
Protocolli | |
FIRStorageTaskManagement | StorageTaskManagement |
Dichiarazioni dei tipi | |
FIRStorageHandle | StorageHandle |
FIRStorageVoidDataError | StorageVoidDataError |
FIRStorageVoidError | StorageVoidError |
FIRStorageVoidMetadata | StorageVoidMetadata |
FIRStorageVoidMetadataError | StorageVoidMetadataError |
FIRStorageVoidSnapshot | StorageVoidSnapshot |
FIRStorageVoidURLError | StorageVoidURLError |