# Upgrade from 3.x to 4.0.0

Version 4.0.0 of the Customer.io Flutter SDK adds Swift Package Manager (SPM) support for iOS.

## What changed?[](#what-changed)

Version 4.0.0 of the Flutter SDK adds Swift Package Manager (SPM) support as an alternative iOS dependency manager. SPM is Apple’s built-in package manager with native Xcode integration, so you don’t need to manage a separate Podfile for Customer.io dependencies. When SPM is enabled, the SDK is automatically resolved - no manual Xcode package setup needed for the main app.

CocoaPods continues to work. If you want to stay on CocoaPods, you don’t need to change anything.

## Upgrade process[](#upgrade-process)

Update to version 4.0.0 or later of the Customer.io Flutter SDK in your `pubspec.yaml`:

```yaml
dependencies:
  customer_io: ^4.0.0
```

### If you use CocoaPods (no changes needed)[](#if-you-use-cocoapods-no-changes-needed)

If you want to continue using CocoaPods, you don’t need to change anything. Your existing Podfile will continue to work. Just update the SDK version above and run `pod install --repo-update --project-directory=ios`.

### If you want to switch to SPM[](#if-you-want-to-switch-to-spm)

#### Requirements[](#requirements)

*   Flutter 3.24+
*   Xcode 16.0+
*   `firebase_core: ^3.5.0` or higher (we recommend at least `^4.6.0`)
*   `firebase_messaging: ^15.2.0` or higher (we recommend at least `^16.1.3`)

Older versions of `firebase_core` and `firebase_messaging` don’t support SPM and cause module conflicts.

#### Steps[](#steps)

1.  **Update Firebase dependencies** in your `pubspec.yaml` to SPM-compatible versions:
    
    ```yaml
    dependencies:
      firebase_core: ^3.5.0  # we recommend at least ^4.6.0
      firebase_messaging: ^15.2.0  # we recommend at least ^16.1.3
    ```
    
2.  **Enable SPM (if not already enabled).** If you haven’t enabled Swift Package Manager in your Flutter project, you can do so globally or per-project:
    
    *   **Global**: Run `flutter config --enable-swift-package-manager`
        
    *   **Per-project**: Add the following to your `pubspec.yaml`:
        
        ```yaml
        flutter:
          config:
            enable-swift-package-manager: true
        ```
        
3.  **Remove CIO pod lines and the NSE target from your Podfile.** Remove any `customer_io` pod lines and the `NotificationServiceExtension` target block:
    
    ```ruby
    pod 'customer_io/fcm', :path => ...
    pod 'customer_io/location', :path => ...
    pod 'customer_io_richpush/fcm', :path => ...
    ```
    
    With SPM enabled, Flutter’s pod helper automatically skips SPM-handled plugins. The core SDK, in-app messaging, and push notifications modules (`DataPipelines`, `MessagingInApp`, `MessagingPushFCM`) are automatically included via SPM - no additional setup needed.
    
     Using the Location module?
    
    If you use the Location module, make sure `customerio_location_enabled=true` is set in your `android/gradle.properties`. This flag controls Location inclusion on both Android and iOS when using SPM. If the flag can’t be read (e.g. in add-to-app modules or some CI setups), you can use the `CIO_LOCATION` environment variable as a fallback: `CIO_LOCATION=true flutter build ios`. See [Location tracking](/integrations/sdk/flutter/tracking/location/) for details.
    
4.  **Remove the old CocoaPods framework from the NSE target** in Xcode. Go to your **NotificationServiceExtension** target > **General** > **Frameworks, Libraries, and Embedded Content** and remove `Pods_NotificationServiceExtension.framework`.
    
5.  **Add the SPM framework to the NSE target.** In the same **Frameworks and Libraries** section, click **+** and add **FlutterGeneratedPluginSwiftPackage**.
    
    [![Add FlutterGeneratedPluginSwiftPackage to the NotificationServiceExtension target](https://docs.customer.io/images/xcode-nse-spm-framework.png)](#63f96c00dae3d457f55911fae69d4722-lightbox)
    
6.  **Add `import UserNotifications`** to the top of your `NotificationService.swift`:
    
    ```swift
    import CioMessagingPushFCM
    import UserNotifications
    ```
    
    SPM doesn’t transitively import system frameworks like CocoaPods does, so you must add the import.
    
7.  **Clean and rebuild:**
    
    ```bash
    cd ios && rm -rf Pods Podfile.lock
    cd .. && flutter clean && flutter pub get
    flutter build ios
    ```
    

## Troubleshooting[](#troubleshooting)

If you run into issues during migration, see [SPM troubleshooting](/integrations/sdk/flutter/getting-started/troubleshooting/#spm-issues) for solutions to common problems like module conflicts, deployment target errors, and CI build failures.