I’m getting a build error when trying to run my Flutter app on iOS simulator. The error seems to be related to the url_launcher_ios plugin.
Error Message:
/Users/user/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/ios/Classes/Launcher.swift:20:1: error: type 'UIApplication' does not conform to protocol 'Launcher'
extension UIApplication: Launcher {}
^
UIKit.UIApplication:24:15: note: candidate has non-matching type '(URL, [UIApplication.OpenExternalURLOptionsKey : Any], (@MainActor @Sendable (Bool) -> Void)?) -> Void'
open func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:], completionHandler completion: (@MainActor @Sendable (Bool) -> Void)? = nil)
What I’ve tried:
Updated Podfile to use iOS 12.0:
platform :ios, '12.0'
Cleaned and reinstalled dependencies:
flutter clean
flutter pub get
cd ios
pod deintegrate
pod cache clean --all
pod install
pubspec.yaml dependencies:
dependencies:
flutter:
sdk: flutter
url_launcher: ^6.2.4
My Question:*
I have recently updated the Simulator to 18.1 iPhone 16 Plus and these different errors started to pop up a previous error was:
suggests that the build process for your iOS app
in Xcode failed, and the main issue seems to be
that certain Flutter dependencies (e.g., sqflite)
are unable to locate Flutter.h
What is the reason for finding this error and how can I fix it?
this is the full error
Writing result bundle at path:
/var/folders/cd/yh1682_95jz__1z337mbc0dh0000gp/T/flutter_tools.KNaYLQ/flutter_ios_build_temp_dir1iOiMu/temporary_xcresult_bundle
/Users/User/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/ios/Classes/Launcher.swift:20:1: error: type 'UIApplication' does not conform to protocol 'Launcher'
extension UIApplication: Launcher {}
^
UIKit.UIApplication:24:15: note: candidate has non-matching type '(URL, [UIApplication.OpenExternalURLOptionsKey : Any], (@MainActor @Sendable (Bool) -> Void)?) -> Void'
open func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:], completionHandler completion: (@MainActor @Sendable (Bool) -> Void)? = nil)
^
/Users/User/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/ios/Classes/Launcher.swift:20:1: note: add stubs for conformance
extension UIApplication: Launcher {}
^
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'PromisesObjC' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'OrderedSet' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'path_provider_foundation-path_provider_foundation_privacy' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'nanopb' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'image_picker_ios-image_picker_ios_privacy' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'shared_preferences_foundation-shared_preferences_foundation_privacy' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'url_launcher_ios-url_launcher_ios_privacy' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'google_mobile_ads-google_mobile_ads' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'url_launcher_ios' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'shared_preferences_foundation' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'path_provider_foundation' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'GoogleUtilities' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'flutter_inappwebview' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'GoogleAppMeasurement' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'image_picker_ios' from project 'Pods')
note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'Flutter' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'Google-Mobile-Ads-SDK' from project 'Pods')
/Users/User/StudioProjects/Project/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 18.1.99. (in target 'GoogleUserMessagingPlatform' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 16 Plus.
If anything is unclear or need more code snippets please let me know
This is the only project that is not working other projects simulator is working
2
Answers
Update your dependencies in pubspec.yml to the compatible version
Run
Then clean and build cache
try to use latest version of ‘url_launcher’, then run:
$ flutter pub get
$ flutter pub upgrade
source: https://github.com/flutter/flutter/issues/155342#issuecomment-2361005231