Migrate from Cocoapods to SPM
Support for SPM (iOS)CocoaPods trunk is becoming read-only. Apps that use CocoaPods will keep working, but new versions of the IDWise iOS SDK's dependencies will only be available through Swift Package Manager (SPM). Here's how to move your Flutter app's iOS build to SPM.
Requirements
| Requirement | Version |
|---|---|
| idwise_flutter_sdk | 7.1.0 or later |
| Flutter | 3.27 or later (3.44+ recommended) |
| Xcode | 15.3 or later |
| iOS deployment target | 15.6 or later |
1. Update the SDK
In your app's pubspec.yaml:
dependencies:
idwise_flutter_sdk: 7.1.02. Turn on Swift Package Manager
How you turn it on depends on your Flutter version. Check it with flutter --version.
| Flutter version | What to do |
|---|---|
| 3.44 or later | Nothing. SPM is on by default. |
| 3.35 – 3.43 | Add the setting below to your app's pubspec.yaml. |
| 3.27 – 3.34 | Run flutter config --enable-swift-package-manager. |
For Flutter 3.35 – 3.43, add this under flutter: in your app's pubspec.yaml:
flutter:
config:
enable-swift-package-manager: true3. Set the iOS deployment target
- Open
ios/Runner.xcworkspacein Xcode. - Select the Runner target, then the General tab.
- Under Minimum Deployments, set iOS to 15.6 or later.
4. Remove the IDWise source from your Podfile
In ios/Podfile, delete this line:
source 'https://github.com/idwise/ios-sdk'Keep the rest of the Podfile if other plugins in your app still use CocoaPods.
5. Install
flutter clean
flutter pub get
flutter runFlutter adds Swift Package Manager to your Xcode project and downloads the IDWise SDK automatically.
6. Check that SPM is in use
Open ios/Runner.xcworkspace in Xcode. idwise-ios-sdk should appear under Package Dependencies.
Commit the files Flutter changed, including ios/Runner.xcodeproj/project.pbxproj and ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved.
Troubleshooting
| Problem | Fix |
|---|---|
| "The package product requires minimum platform version 15.6" | Set the deployment target to 15.6 (step 3). |
| The app still installs IDWise through CocoaPods | Run the commands from your app's root folder, or run flutter config --enable-swift-package-manager. |
The config: setting in pubspec.yaml has no effect | Your Flutter version is older than 3.35. Use flutter config --enable-swift-package-manager instead. |
Need to go back?
- Set
enable-swift-package-manager: falsein yourpubspec.yaml. If you usedflutter config, runflutter config --no-enable-swift-package-managerinstead. - Add
source 'https://github.com/idwise/ios-sdk'back toios/Podfile, together withsource 'https://cdn.cocoapods.org/'. - Run the install steps again.
The IDWise SDK switches back to CocoaPods.
Updated 5 minutes ago
