Upgrade from 4.x to 5.0.0
Version 5.0.0 of the iOS SDK requires iOS 15 or later. If you send push notifications through Firebase Cloud Messaging (FCM), you now get the CioFirebaseWrapper package from customerio-ios instead of customerio-ios-fcm.
What changed?
Version 5.0.0 has two changes that can affect your app:
- iOS 15 or later: The SDK now requires iOS 15 or later. If your app needs to support iOS 13 or 14, stay on version 4.x.
CioFirebaseWrappermoved intocustomerio-ios: If you use FCM, you now getCioFirebaseWrapperfrom thecustomerio-iospackage, and it has the same version number as the rest of the SDK. The separatecustomerio-ios-fcmpackage only works with SDK versions before 5.0.0, so you need to remove it.
If you send push notifications through Apple Push Notification service (APNs), the new iOS minimum is the only change that affects you. Your app doesn’t need Firebase.
You don’t need to change your code. Your import statements and your MessagingPushFCM.initialize call stay the same.
Upgrade process
1. Raise your deployment target to iOS 15
In Xcode, set the minimum deployment target to iOS 15.0 or later for your app and for any app extension that uses the SDK, like your Notification Service Extension.
If you use CocoaPods, update the platform in your Podfile too:
platform :ios, '15.0'2. Update your dependencies
Swift Package Manager (SPM)
- If you added the
customerio-ios-fcmpackage, remove it. In Xcode, select your project, go to Package Dependencies, selectcustomerio-ios-fcm, and click -. Swift Package Manager can’t resolvecustomerio-ios5.0.0 whilecustomerio-ios-fcmis still in your project. - Update
customerio-iosto version 5.0.0 or later. If you use the Up to Next Major Version dependency rule, set it to start at 5.0.0. - If you use FCM, add the
CioFirebaseWrapperproduct fromcustomerio-iosto your app target. Select your app target, go to General > Frameworks, Libraries, and Embedded Content, click +, and selectCioFirebaseWrapper. - If you use FCM, make sure your app includes the
FirebaseMessagingproduct fromhttps://github.com/firebase/firebase-ios-sdk, version 8.7.0 or later. Thecustomerio-ios-fcmpackage added Firebase to your app for you, butcustomerio-iosdoesn’t. If your app doesn’t haveFirebaseMessagingyet, add it.
CocoaPods
-
If you use FCM, update
CioFirebaseWrapperin yourPodfile:RUBYpod 'CioFirebaseWrapper', '~> 5.0'This pod also installs
FirebaseMessaging. If your app gets Firebase another way, like through Swift Package Manager, usepod 'CioFirebaseWrapper/Core', '~> 5.0'instead. It installsCioFirebaseWrapperwithout Firebase.If you set versions for your
CustomerIOpods, change them to'~> 5.0'too. -
Update your pods. If you use FCM, run:
BASHpod update CustomerIO CioFirebaseWrapperIf you use APNs, run
pod update CustomerIO.
3. Check that Firebase is linked (FCM only)
The SDK finds FirebaseMessaging in your app when your app runs. If your app doesn’t link FirebaseMessaging when you call MessagingPushFCM.initialize, the SDK stops your app with an error that tells you to add it. Check this if you use Swift Package Manager or CioFirebaseWrapper/Core, because neither one installs Firebase for you.
If your app links Firebase statically, make sure your app target includes -ObjC in Build Settings > Other Linker Flags.