Building for iOS fails
=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===
/Development/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:50:45: error: type 'UIApplication' has no member 'UIApplicationOpenSettingsURLString'
guard let url = URL(string: UIApplication.UIApplicationOpenSettingsURLString),
^~~~~~~~~~~~~~~
/Development/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-2.1.2/ios/Classes/PermissionManager.swift:59:77: error: type 'UIApplication' has no member 'UIApplicationOpenSettingsURLString'
let success = UIApplication.shared.openURL(URL.init(string: UIApplication.UIApplicationOpenSettingsURLString)!)
Version: 2.1.2
Platform:
Running into the same problem.
the same problem, only in ios .
Same problem, only in IOS.
Same problem on my side, also only in iOS... Any update on this?
Forcing Flutter to use V2.1.0 fixes the problem for now...
(And if you use the "Geolocator" package, then force both packages to use V2.1.0)
geolocator: 2.1.0
permission_handler: 2.1.0
Remember to run flutter clean in the terminal and then get your .yaml dependencies again before running your app.
Still didn't resolve issue for me ¯\_(ツ)_/¯
@daryll-fourie That worked for me.
I had to downgrade geolocator to 2.0.2 and permission_handler to 2.0.1 to get this to work.
Version 2.1.2 works for me, after I updated ios/Podfile:
target 'Runner' do
use_frameworks! # < ADD THIS
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
...
Thank you @daryll-fourie! I should have looked here first!
I had this problem too. The root-cause is actually that the project generated by Flutter is set to "Swift 4.0" by default, instead of "Swift 4.2".
I had a Pull Request to rollback the API changes for compatibility but 4.0, but closed it because I wasn't sure if it was appropriate for the develop branch.
There are a couple of ways to fix this:
1: down grade permission_handler's version to 2.1.0
if running into this error : can't find file :
2: open permission_handler source code, find "PermissionHandlerPlugin.m" ,
and edit
solve my issue
Dear 562218352 ,
Can you explain in detail your resolution , I am new to mobile development, your detail help will be highly appreciated.
Thanks.
@daryll-fourie That worked for me.
@muhammadkhayyam, @ahmedb, @562218352, to be able to use version 2.1.2 of the permission handler you'll have to use Xcode 10.1 or higher and make sure you update your Podfile to reflect the following changes:
In your Podfile make sure you add the line use_frameworks! (best is to add this line directly below the target Runner do like so:
target 'Runner' do
use_frameworks!
Also in your Podfile make sure you add the line config.build_settings['SWIFT_VERSION'] = '4.2' to the post_installer block. After adding this line the post_installer block should look like this:
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.2'
end
end
end
Most helpful comment
Forcing Flutter to use V2.1.0 fixes the problem for now...
(And if you use the "Geolocator" package, then force both packages to use V2.1.0)
example code
geolocator: 2.1.0permission_handler: 2.1.0Remember to run
flutter cleanin the terminal and thengetyour .yaml dependencies again before running your app.