Fails to compile for IOS using Codemagic - ios

I'm having trouble trying to compile on code magic, I don't have access to an Apple device. Can you tell me how to fix it?
I saw that to fix this problem I would have to perform these steps: Open [YourProject]/ios/Podfile and remove the # sign from platform :ios, '9.0' and try flutter run. If it doesn't work increase the version number for example to 10.0
as per the link: Error running pod install - Automatically assigning platform `iOS` with version `8.0` on target `Runner`
But how to resolve this in codemagic without macOS.
LOG ERROR IN CODEMAGIC:
== Building for iOS ==
> flutter build ios --debug --no-codesign
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.jumilAssistencia for device (ios)...
Running pod install... 4.9s
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
firebase_core: Using Firebase SDK version '8.3.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_messaging` from `.symlinks/plugins/firebase_messaging/ios`
firebase_messaging: Using Firebase SDK version '8.3.0' defined in 'firebase_core'
-> Fetching podspec for `geocoder` from `.symlinks/plugins/geocoder/ios`
-> Fetching podspec for `google_maps_flutter` from `.symlinks/plugins/google_maps_flutter/ios`
-> Fetching podspec for `location` from `.symlinks/plugins/location/ios`
-> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
-> Fetching podspec for `qr_code_scanner` from `.symlinks/plugins/qr_code_scanner/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `url_launcher` from `.symlinks/plugins/url_launcher/ios`
Resolving dependencies of `Podfile`
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
CDN: trunk Relative path downloaded: CocoaPods-version.yml, save ETag: "612aa752-3d"
CocoaPods 1.11.0.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.0.rc.1
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "firebase_core":
In Podfile:
firebase_core (from `.symlinks/plugins/firebase_core/ios`)
Specs satisfying the `firebase_core (from `.symlinks/plugins/firebase_core/ios`)` dependency were found, but they required a higher minimum deployment target.
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:94:in `resolve'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1074:in `block in resolve_dependencies'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Users/builder/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/Users/builder/.rbenv/versions/2.7.2/bin/pod:23:in `load'
/Users/builder/.rbenv/versions/2.7.2/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Build failed :|
Failed to build for iOS

You can access a codemagic own Macs during build via ssh or vnc, see the docs here. But I would personally just create a new flutter project and use the ios folder with all the configurations up to date. I recently set up CD through codemagic using a Flutter 2.2 generated ios config and had no issues.

Related

expo EAS build (iOS) fails in Pod installation step (SDK45 & 46)

I am trying to build iOS app (simulator) from expo managed project. The build fails At Pod installation step.
In Expo SDK 44 everything is okay. But when I upgrade to SDK 45 or even 46, I am facing the issue.
Here are some logs from expo server:
Run Expo Doctor
Running "expo doctor"
- Finding all copies of expo-modules-autolinking
- Finding all copies of #expo/config-plugins
[stderr]
[02:48:23] Expected package #expo/config-plugins#^5.0.0
[stderr]
[02:48:23] Found invalid:
[stderr]
[02:48:23] #expo/config-plugins#4.1.5
[stderr]
[02:48:23] (for more info, run: npm why #expo/config-plugins)
- Finding all copies of #expo/prebuild-config
- Finding all copies of #unimodules/core
- Finding all copies of #unimodules/react-native-adapter
- Finding all copies of react-native-unimodules
[stderr]
[02:48:28] Some dependencies are incompatible with the installed expo package version:
[stderr]
[02:48:28] - react - expected version: 18.0.0 - actual version installed: 17.0.2
[stderr]
[02:48:28] - react-dom - expected version: 18.0.0 - actual version installed: 17.0.2
[stderr]
[02:48:28] - react-native - expected version: 0.69.4 - actual version installed: 0.68.2
[stderr]
[02:48:28] Your project may not work correctly until you install the correct versions of the packages.
[stderr]
To install the correct versions of these packages, please run: expo doctor --fix-dependencies,
[stderr]
or install individual packages by running expo install [package-name ...]
[stderr]
[02:48:31] Warning: Invalid version react-native#0.68.2 for expo sdkVersion 46.0.0. Use react-native#0.69.4
Command "expo doctor" failed.
bash exited with non-zero code: 1
Install Pods
Installing pods
Using Expo modules
Auto-generating `.xcode.env.local` with $NODE_BINARY=/Users/expo/.nvm/versions/node/v16.13.2/bin/node
Auto-linking React Native modules for target `Classima`: RNDateTimePicker, RNGestureHandler, RNReanimated, RNSVG, RNScreens, lottie-react-native, react-native-maps, react-native-netinfo, react-native-safe-area-context, react-native-slider, react-native-webview, and stripe-react-native
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
[!] CocoaPods could not find compatible versions for pod "RCT-Folly":
In snapshot (Podfile.lock):
RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
In Podfile:
RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
It seems like you've changed the version of the dependency `RCT-Folly` and it differs from the version stored in `Pods/Local Podspecs`.
You should run `pod update RCT-Folly --no-repo-update` to apply changes made locally.
Error: Compatible versions of some pods could not be resolved.
You are seeing this error because either:
- Versions in the Podfile.lock cached by EAS do not match required values for some of the libraries, it can be triggered when upgrading Expo SDK or any other library with native code. To fix that add the "cache.key" field (it can be set to any value) in the build profile in eas.json to invalidate the cache.
- Some of your npm packages have native code that depend on different versions of the same pod. Please see logs for more info.
Fail Build
Build failed: Compatible versions of some pods could not be resolved.
You are seeing this error because either:
- Versions in the Podfile.lock cached by EAS do not match required values for some of the libraries, it can be triggered when upgrading Expo SDK or any other library with native code. To fix that add the "cache.key" field (it can be set to any value) in the build profile in eas.json to invalidate the cache.
- Some of your npm packages have native code that depend on different versions of the same pod. Please see logs for more info.
eas build -p ios --clear-cache
I am facing the same issue, i tried "eas build -p ios --clear-cache" but nothing changed. The build fails at the pod install
Here are the logs:
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Auto-linking React Native modules for target `BallNConnect`: RNCAsyncStorage, RNCMaskedView, RNDateTimePicker, RNDeviceInfo, RNFBApp, RNFBFirestore, RNGestureHandler, RNReanimated, RNScreens, RNVectorIcons, lottie-ios, lottie-react-native, react-native-maps, and react-native-safe-area-context
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
CocoaPods 1.11.3 is available.
To update use: `sudo gem install cocoapods`
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.3
[!] CocoaPods could not find compatible versions for pod "GoogleMaps":
In Podfile:
react-native-google-maps (from `/Users/expo/workingdir/build/node_modules/react-native-maps`) was resolved to 0.29.4, which depends on
Google-Maps-iOS-Utils (= 2.1.0) was resolved to 2.1.0, which depends on
GoogleMaps
react-native-google-maps (from `/Users/expo/workingdir/build/node_modules/react-native-maps`) was resolved to 0.29.4, which depends on
GoogleMaps (= 3.5.0)
CocoaPods could not find compatible versions for pod "nanopb":
In Podfile:
EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`) was resolved to 4.1.1, which depends on
Firebase/Core (= 7.7.0) was resolved to 7.7.0, which depends on
FirebaseAnalytics (= 7.7.0) was resolved to 7.7.0, which depends on
nanopb (~> 2.30907.0)
RNFBFirestore (from `../node_modules/#react-native-firebase/firestore`) was resolved to 12.9.3, which depends on
Firebase/Firestore (= 8.8.0) was resolved to 8.8.0, which depends on
FirebaseFirestore (~> 8.8.0) was resolved to 8.8.0, which depends on
nanopb (~> 2.30908.0)
[stderr] [!] `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` attempted to initialize an object with an unknown UUID. `6D6F16C9EE89401295D6CEB6` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
Error: Compatible versions of some pods could not be resolved.
You are seeing this error because either:
- Versions in the Podfile.lock cached by EAS do not match required values in Podspecs of some of the libraries. To fix that add the "cache.key" field (it can be set to any value) in the build profile in eas.json to invalidate the cache.
- Some of the pods used in your project depend on different versions of the same pod. See logs for more information.```

Pods error trying to build Expo managed workflow app on SDK 45 using EAS build

I'm trying to build my Expo (managed workflow) app using EAS build:
eas build -p ios
and it's failing with the following error (expo.dev / build details):
Installing pods
Using Expo modules
Auto-linking React Native modules for target `livehere`: RNCClipboard, RNCMaskedView, RNDateTimePicker, RNGestureHandler, RNReanimated, RNSVG, RNScreens, RNSentry, react-native-maps, react-native-safe-area-context, and react-native-segmented-control
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
[!] Unable to add a source with url `https://cdn.cocoapods.org/` named `trunk`.
You can try adding it manually in `/Users/expo/.cocoapods/repos` or via `pod repo add`.
pod exited with non-zero code: 1
so the problem is in 3 last lines. My eas-cli, expo are updated to latest versions.
Looks like there's a major CDN outage. https://status.cocoapods.org

The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (.../ios/Flutter/Flutter.framework)

After upgrading to flutter version 1.17.4 when running flutter build ios I get following output:
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (.../ios/Flutter/Flutter.framework)
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:590:in `validate_targets'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:158:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error running pod install
What I tried:
Deleting ios/Flutter/Flutter.framework and running pod install as suggested here didn't help
Adding s.static_framework = true to Flutter.podspec - no luck
Deleting-recreating ios folder - no luck
Commenting out use_frameworks! in Podfile - leads to errors in plugins like fatal error: '..._plugin-Swift.h' file not found
I also tried to downgrade the flutter as I didn't have any problem with prev one. But running flutter version v1.17.2 resulted in error:
Error: ProcessException: Process exited abnormally:
error: unsupported sort specification 'creatordate'
I'm stuck with this.
If this issue occured while you trying to implement your own flutter plugin, then simply add this line below dependencies to .podspec
s.static_framework = true
I get same problem with this error output:
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:
(/.../ios/Flutter/Flutter.framework)
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in
verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in `verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:595:in `validate_targets'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
I have solved problem with tried this step:
Open your folder ios in your project and open Podfile and you will see code like this:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
You can remove code use_frameworks! and use_modular_headers! and this is complete code:
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
If you have follow instruction you can save change file and hit flutter run
This is complete output:
Running pod install... 3.1s
Running Xcode build...
└─Compiling, linking and signing... 28.0s
Xcode build done. 73.0s
Waiting for iPhone 12 Pro Max to report its views... 19ms
Syncing files to device iPhone 12 Pro Max... 1,218ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on iPhone 12 Pro Max is available at: http://127.0.0.1:50854/VhaUEREqLb0=/
*Disclaimer:
I'm quite new to programming & coding and Flutter is my first programming language. But having struggled with this for 3 days, I believe I have fixed my code. Hoping this helps. Please excuse if this doesn't make sense.
Other Newbies reading this: Do this only if you have a backup of your script, and all of above solutions failed for you.*
Background
My problem occurred when I upgraded Xcode to 12.0.1. Got the same error:
The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:
I believe in the upgrade process, some link in an unknown location broke between Flutter, Cocoa-pods & Xcode. I wasn't sure whether something broke internally within my project or within the platforms. Hence, I launched a new flutter project and confirmed it was the latter when that brand new project failed to launch on the Simulator.
Solution
My solution was to rejig the whole platform architecture, rather than re-writing the whole app code.
Step 1: Take a backup of your code (I didn't; got lucky or was just tired with the multiple iterations & backups.)
Step 2: Uninstalled Flutter (Restarted the Mac) and then Reinstalled Flutter on VSCODE
Step 3: Completely Uninstalled Cocoa-pods & Reinstalled Cocoapods. Followed the steps mentioned here.
[Now in your Project]
Step 4: In the terminal, type 'flutter clean' to clean all caches pre-built for the project
Step 5: Delete (or Rename) '/ios' folder (to something else like '/111ios')
Step 6: Recreate a new /ios folder. In the terminal, type
flutter create -i swift
You might need to specify your root PWD for the command to build the ios folder in the right directory.
Step 7: Get packages
flutter pub get
Step 8: Flutter Run.
The above got my boat sailing again. Hopefully this helps the community!

Flutter: Unable to remove custom plugin from being included in ios app

I wrote a custom flutter plugin for windows which works fine so far.
For some reason though, flutter keeps including the plugin in the ios build when I'm trying to run it on the iphone simulator. This causes errors because the plugin doesn't have a ios implementation.
On Android everything works fine.
Here is the plugins pubspec.yaml:
name: fbfunctions
description: A new flutter plugin project.
environment:
sdk: ">=2.7.0 <3.0.0"
flutter: ">=1.10.0"
dependencies:
flutter:
sdk: flutter
flutter:
plugin:
platforms:
windows:
pluginClass: FbfunctionsPlugin
And here is the error I get when trying to run on the ios simulator:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 2.5s
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (`arm64`)
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
-> Fetching podspec for `cloud_firestore_web` from `.symlinks/plugins/cloud_firestore_web/ios`
-> Fetching podspec for `cloud_functions` from `.symlinks/plugins/cloud_functions/ios`
-> Fetching podspec for `cloud_functions_web` from `.symlinks/plugins/cloud_functions_web/ios`
-> Fetching podspec for `fbfunctions` from `.symlinks/plugins/fbfunctions/ios`
[!] No podspec found for `fbfunctions` in `.symlinks/plugins/fbfunctions/ios`
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/external_sources/path_source.rb:14:in `block in fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/external_sources/path_source.rb:11:in `fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:980:in `fetch_external_source'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:959:in `block (2 levels) in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:958:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:958:in `block in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:957:in `fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:117:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `10.1` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Error launching application on iPhone 11 Pro Max.
How do I prevent flutter from trying to include the plugin in the ios build?
You can't; currently Flutter expects every plugin to have an iOS podspec. Until that is resolved, the workaround is to include a dummy ios/your_plugin_name.podspec, as you can see in federated flutter/plugins plugins.
You don't need anything in the folder other than the podspec, and once the issue is fixed you can remove it.

Conflict between location and url_launcher plugin

I'm developing an app which finds points of interest around the location of the user. To get the location of the user I use the location plugin which works quite nicely.
The next thing I'd like to implement is a button to open the default mapping application to navigate the user to the POI. I went at it using the url_launcher plugin and the geo: url scheme for android and the maps: scheme for iOS.
Independent of each other both plugins work as expected. Once I had both plugins in my project the problems started. Using the default setup of flutter create I get the following error:
Launching lib/main.dart on iPhone 6 in debug mode...
Running pod install...
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (`arm64`)
Finding Podfile changes
- Flutter
- location
- url_launcher
Fetching external sources
-> Fetching podspec for `Flutter` from `/Users/rainerwittmann/Flutter/flutter/bin/cache/artifacts/engine/ios`
-> Fetching podspec for `location` from `/Users/rainerwittmann/.pub-cache/hosted/pub.dartlang.org/location-1.0.2/ios`
-> Fetching podspec for `url_launcher` from `/Users/rainerwittmann/.pub-cache/hosted/pub.dartlang.org/url_launcher-0.4.2+1/ios`
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
- Flutter
- location
- url_launcher
Downloading dependencies
-> Using Flutter (1.0.0)
-> Using location (0.0.1)
-> Using url_launcher (0.0.1)
- Running pre install hooks
[!] Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pod being used is: location
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:448:in `block (2 levels) in verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:443:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:443:in `block in verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:440:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:440:in `verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:114:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command/install.rb:37:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command.rb:50:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error running pod install
Error launching application on iPhone 6.
So far so good. Adding use_frameworks! to my podfile, as suggested by the error message resulted in another error:
Launching lib/main.dart on iPhone 6 in debug mode...
Running pod install...
Running Xcode build...
Failed to build iOS app
Error output from Xcode build:
↳
** CLEAN FAILED **
The following build commands failed:
Check dependencies
(1 failure)
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Xcode's output:
↳
Build settings from command line:
ARCHS = x86_64
BUILD_DIR = /Users/rainerwittmann/Flutter/zapfsuche/build/ios
ONLY_ACTIVE_ARCH = YES
SDKROOT = iphonesimulator10.3
=== CLEAN TARGET location OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies
“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
=== CLEAN TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies
=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies
=== BUILD TARGET location OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies
“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
Could not build the application for the simulator.
Error launching application on iPhone 6.
Unfortunately I have no idea how to proceed from here. Can somebody help me sort this out?
Note
This problem only exists on iOS. Both plugins work like a charm on android.
Swift plugins require use_frameworks! and that isn't fully supported yet.
I'm currently working on it. Thanks for your patience!
Edit Podfile
Add/uncomment after "target 'Runner' do" line number ~35
use_frameworks!
Then add this line after line number ~67
config.build_settings['SWIFT_VERSION'] = '4.0'
Example:
target 'Runner' do
** use_frameworks! **
........ ......
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
** config.build_settings['SWIFT_VERSION'] = '4.0' **
end
end
end
delete your Podfile.lock and try.

Resources