I have an Image Picker dependency in my app, it's always worked fine as far as I'm aware and all of a sudden I can't compile my app for iOS. It's throwing me an error related to CocoaPods, I'm really not sure what to do about it. Error is below, do you have any idea what I could do to resolve that situation? Thanks in advance !
### Stack
CocoaPods : 1.11.3
Ruby : ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin21]
RubyGems : 3.4.2
Host : macOS 12.6.1 (21G217)
Xcode : 14.0.1 (14A400)
Git : git version 2.37.0 (Apple Git-136)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.2.0/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
### Plugins
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.1
cocoapods-trunk : 1.6.0
cocoapods-try : 1.2.0
### Podfile
ruby
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
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)
# Workaround https://github.com/flutter/flutter/issues/111475.
target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'
target.build_configurations.each do |build_configuration|
if target_is_resource_bundle
build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'
build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'
end
end
target.build_configurations.each do |config|
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
# 'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
## dart: PermissionGroup.notification
# 'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1',
]
end
end
end
### Error
NoMethodError - undefined method `=~' for [["PICKER_MEDIA=1"], ["PICKER_AUDIO=1"], ["PICKER_DOCUMENT=1"]]:Array
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:446:in `block (2 levels) in merged_xcconfigs'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:446:in `all?'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:446:in `block in merged_xcconfigs'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:444:in `each'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:444:in `each_with_object'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:444:in `merged_xcconfigs'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:1057:in `block in <class:PodTargetSettings>'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/target/build_settings.rb:120:in `block in define_build_settings_method'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:177:in `block in remove_pod_target_xcconfig_overrides_from_target'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:174:in `each'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:174:in `remove_pod_target_xcconfig_overrides_from_target'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:157:in `block in add_target'
<internal:kernel>:90:in `tap'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:156:in `add_target'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:47:in `block in install!'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:149:in `message'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb:40:in `install!'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:115:in `block in install_pod_targets'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:112:in `map'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:112:in `install_pod_targets'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/single_pods_project_generator.rb:32:in `block in install_all_pod_targets'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:149:in `message'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/single_pods_project_generator.rb:31:in `install_all_pod_targets'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/xcode/single_pods_project_generator.rb:19:in `generate!'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:314:in `block in create_and_save_projects'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:309:in `create_and_save_projects'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:301:in `generate_pods_project'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:180:in `integrate'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:167:in `install!'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/bin/pod:25:in `<main>'
Running brew reinstall cocoapods fixed the issue.
Related
I'm using flutter to create an app for both ios and android. I need photos and storage permission for ios and android to access photos to update user profile pictures.
I used the permission_handler package to request permissions. And this works well in android but not in ios.
<key>NSPhotoLibraryUsageDescription</key>
<string>We need Photos access to allow you to update Profile Picture.</string>
var permission = Platform.isAndroid
? Permission.storage
: Permission.photos;
var permissionStatus = await permission.request();
print("isGranted: " +
permissionStatus.isGranted.toString() +
" isDenied: " +
permissionStatus.isDenied.toString() +
" isLimited: " +
permissionStatus.isLimited.toString() +
" isRestricted: " +
permissionStatus.isRestricted.toString() +
" isPermanentlyDenied: " +
permissionStatus.isPermanentlyDenied.toString());
flutter: isGranted: false isDenied: false isLimited: false isRestricted: false isPermanentlyDenied: true
I tried to uninstall and reinstall the app on the simulator (iPhone 12pro max) but still not able to request permission (show request popup).
I tried this, this, this and this. but the issue remains.
First copy and past below code into your podfile. Than set 'PERMISSION_PHOTOS=1', if you dont want use another permission you can delete or set it =0 (exp 'PERMISSION_CAMERA=0', ).
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# You can remove unused permissions here
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
## dart: PermissionGroup.reminders
## dart: PermissionGroup.contacts
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
## dart: PermissionGroup.notification
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
## dart: PermissionGroup.bluetooth
## dart: PermissionGroup.appTrackingTransparency
'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
'PERMISSION_SENSORS=1'
]
end
end
end
Than add this into Info.plist file
<key>NSPhotoLibraryUsageDescription</key>
<string>We need Photos access to allow you to update Profile Picture.</string>
Finally use permission_handler plugin into your project and add this code where you want to ask permission.
var permissionStatus = await permission.request();
The behavior on iOS for the Permissions package has changed to default all permissions to denied. You have to update the PList and turn on the permissions you wish to use within your application for it to work.
Use latest permission_handler: package.
Add photo permission to your Info.plist file.
<!-- Permission options for the `photos` group -->
<key>NSPhotoLibraryUsageDescription</key>
<string>photos</string>
Add the following to your Podfile file:
post_install do |installer|
installer.pods_project.targets.each do |target|
... # Here are some configurations automatically generated by flutter
# Start of the permission_handler configuration
target.build_configurations.each do |config|
# You can enable the permissions needed here. For example to enable camera
# permission, just remove the `#` character in front so it looks like this:
#
# ## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1'
#
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',
## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
# 'PERMISSION_LOCATION=1',
## dart: PermissionGroup.notification
# 'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1'
]
end
# End of the permission_handler configuration
end
end
if you need to add more permission. Remove the # character in front of the permission you do want to use. for example
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
in flutter, request
var status = await Permission.photos.request();
if (status.isDenied) {
// We didn't ask for permission yet or the permission has been denied before but not permanently.
}
finally
Clean & Rebuild
Hi: I have the above error message. I have done the basic:
changed AppFrameworkInfo.plst to 9.0
Uncommented 9.0 in pod file
but still get this message for each package in my pub spec.
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.9
There are multiple pages (including on SO) saying that to fix this you need to add the following to the end of the pod file.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
My issue is I use the permissions handler package which already has a modified pod file to work around which permissions are included in the final package:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# Here are some configurations automatically generated by flutter
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=0',
## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=0',
## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=0',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=0',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=0',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=0',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=0',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=0',
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=0',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=0'
]
end
end
end
But I can't work out where to include the code to fix the Deployment target. Wherever I paste it in, I get an error (a different one... not the deployment error). I figured out I can't have 2 post_install do lines so I think I need to cut the config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' line but wherever I paste it, it doesn't seem to work.
Permission handler is popular so I figure someone might have run into this before me?
Have you tried this
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
# Here are some configurations automatically generated by flutter
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=0',
## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=0',
## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=0',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=0',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=0',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=0',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=0',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=0',
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=0',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=0'
]
end
end
end
I recently moved my projects to my M1 MacBook Pro. But I get the following error when running flutter run on iPhone 12 Pro Max Simulator.
Resolving dependencies of `Podfile`
――― MARKDOWN TEMPLATE
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/bin/pod install --verbose
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.10.1
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580)
[universal.x86_64-darwin20]
RubyGems : 3.0.3
Host : macOS 11.1 (20C69)
Xcode : 12.3 (12C33)
Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir :
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories :
```
### Plugins
```
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-trunk : 1.5.0
cocoapods-try : 1.2.0
```
### Podfile
```ruby
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter
build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..',
'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're
running pod install manually, make sure flutter pub get is executed
first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}.
Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin',
'podhelper'), flutter_root)
flutter_ios_podfile_setup
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
```
### Error
```
LoadError - dlsym(0x7f84b630ab40, Init_ffi_c): symbol not found -
/Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:6:in `rescue in <top
(required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:3:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top
(required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top
(required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
bygems/core_ext/kernel_require.rb:54:in `require'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/sources_manager.rb:74:in `cdn_url?'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/sources_manager.rb:36:in `create_source_with_url'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/sources_manager.rb:21:in `find_or_create_source_with_url'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer/analyzer.rb:178:in `block in sources'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer/analyzer.rb:177:in `map'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer/analyzer.rb:177:in `sources'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer/analyzer.rb:1072:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer/analyzer.rb:124:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer.rb:414:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer.rb:239:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer.rb:238:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/installer.rb:160:in `install!'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in
`run'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
apods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/bin/pod:
55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `load'
/opt/homebrew/Cellar/cocoapods/1.10.1/libexec/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`.
I tried creating a new flutter app and running it and it worked well, but when I added my dependencies to pubspec.yaml it again showed the same error.
My dependency list
intl: ^0.16.1
firebase_core: ^0.5.0+1
firebase_analytics: ^6.0.2
firebase_crashlytics: ^0.2.1+1
firebase_auth: ^0.18.1+2
firebase_database: ^4.1.1
firebase_messaging: ^7.0.3
cloud_firestore: ^0.14.1+3
firebase_storage: ^4.0.1
firebase_ml_vision: ^0.9.7
firebase_dynamic_links: ^0.6.0+2
firebase_remote_config: ^0.4.0+2
readmore: ^1.0.0
like_button: ^1.0.1
timeago: ^2.0.26
eyro_toast: ^0.1.0
quick_actions: ^0.4.0+10
vibration: ^1.4.0
receive_sharing_intent: ^1.4.0+2
cached_network_image: ^2.2.0+1
full_screen_image: ^1.0.2
flutter_native_image: ^0.0.5+2
image_picker: ^0.6.7+4
image_cropper: ^1.2.3
flutter_blurhash: ^0.5.0
linkify: ^2.1.0
liquid_progress_indicator: ^0.3.2
material_tag_editor: ^0.0.2
carousel_slider: ^2.2.1
liquid_pull_to_refresh: ^2.0.0
animated_splash_screen: ^1.0.0+1
expandable: ^4.1.4
flutter_linkify: ^3.1.3
flutter_parsed_text: ^1.2.4
url_launcher: ^5.5.0
octo_image: ^0.2.1
smooth_page_indicator: ^0.2.0
shimmer: ^1.1.1
pagination_view: ^1.0.3+2
scrollable_positioned_list: ^0.1.7
geocoder: ^0.2.1
location: ^3.0.2
inview_notifier_list: ^1.0.0
share: ^0.6.5+2
visibility_detector: ^0.1.5
animations: ^1.1.2
native_state: ^1.1.1
story_view: ^0.12.3
file_picker: ^1.13.3
mime: ^0.9.7
flutter_colorpicker: ^0.3.4
video_player: ^0.10.12+2
dotted_border: ^1.0.6
step_progress_indicator: ^0.2.4+7
timer_count_down: ^1.0.4+1
flutter_staggered_grid_view: ^0.3.2
flutter_local_notifications: ^1.4.4+4
app_settings: ^4.0.4
flutter_svg: ^0.19.0
flutter_slidable: ^0.5.7
preload_page_view: ^0.1.4
custom_navigation_bar: ^0.3.2
page_transition: ^1.1.7+2
cube_transition: ^1.0.2
provider: ^4.3.2+2
delayed_display: ^1.0.3
supercharged: ^1.10.0
image: ^2.1.18
path_provider: ^1.6.18
meta: ^1.1.6
bitmap: ^0.0.6
numberpicker: ^1.2.1
image_gallery_saver: ^1.6.0
permission_handler: ^5.0.1+1
dio: ^3.0.10
device_preview: ^0.4.8
image_editor: ^0.7.3
extended_image: ^1.3.0
flutter_credit_card: ^0.1.3
stripe_payment: ^1.0.8
charts_flutter: ^0.9.0
flutter_native_admob: ^2.1.0+3
mask_text_input_formatter: ^1.1.0
shared_preferences: ^0.5.12+4
flutter_icons: ^1.1.0
introduction_screen: ^1.0.9
property_change_notifier: ^0.2.0
screenshot: ^0.2.0
auto_size_text: ^2.1.0
responsive_flutter: ^0.0.4
cupertino_icons: ^1.0.0
Run on MacBook Pro (M1)
You need to install ffi dependency manually. Here is the same issue on GitHub: https://github.com/flutter/flutter/issues/70796. Also, if you have troubles with build or run you app on M1, visit to Wiki page on GitHub with usage guide and this issue for tracking current support phase for new macs.
Launching lib/main.dart on iPhone 11 Pro Max 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`: (``)
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `background_fetch` from `.symlinks/plugins/background_fetch/ios`
-> Fetching podspec for `connectivity` from `.symlinks/plugins/connectivity/ios`
-> Fetching podspec for `connectivity_for_web` from `.symlinks/plugins/connectivity_for_web/ios`
-> Fetching podspec for `connectivity_macos` from `.symlinks/plugins/connectivity_macos/ios`
-> Fetching podspec for `devicelocale` from `.symlinks/plugins/devicelocale/ios`
-> Fetching podspec for `esys_flutter_share` from `.symlinks/plugins/esys_flutter_share/ios`
-> Fetching podspec for `firebase_crashlytics` from `.symlinks/plugins/firebase_crashlytics/ios`
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/usr/local/bin/pod install --verbose
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.9.3
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
RubyGems : 3.0.3
Host : Mac OS X 10.15.4 (19E287)
Xcode : 11.4.1 (11E503a)
Git : git version 2.20.1
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git # cee826cdfd82e8ad63f23d532e519f8248a09ce7
trunk - CDN - https://cdn.cocoapods.org/
```
### Plugins
```
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0
```
### Podfile
```ruby
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end
target 'Runner' do
use_frameworks!
use_modular_headers!
# Flutter Pod
copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1' # required by simple_permission
config.build_settings['ENABLE_BITCODE'] = 'NO'
# Here are some configurations automatically generated by flutter
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=0',
## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=0',
## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=0',
## dart: PermissionGroup.camera
#'PERMISSION_CAMERA=0',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=0',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=0',
## dart: PermissionGroup.photos
# 'PERMISSION_PHOTOS=0',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
# 'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
# 'PERMISSION_NOTIFICATIONS=0',
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=0',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=0'
]
end
end
end
pod 'Firebase/MLVisionFaceModel'
```
### Error
```
ArgumentError - Malformed version number string p.0
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/version.rb:47:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/vendor/version.rb:199:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/vendor/version.rb:199:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/vendor/version.rb:192:in `create'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/platform.rb:54:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/specification.rb:517:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/specification.rb:517:in `block in available_platforms'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/specification.rb:517:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/specification.rb:517:in `available_platforms'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/specification.rb:402:in `dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/validator.rb:44:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/abstract_external_source.rb:201:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/abstract_external_source.rb:201:in `validator_for_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/abstract_external_source.rb:186:in `validate_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/abstract_external_source.rb:178:in `store_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/path_source.rb:17:in `block in fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/path_source.rb:11:in `fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:980:in `fetch_external_source'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:959:in `block (2 levels) in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:958:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:958:in `block in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:957:in `fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:117:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156: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>'
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=Malformed+version+number+string+p.0&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- Error running pod install Error launching application on iPhone 11.
https://github.com/CocoaPods/CocoaPods/issues/9981 [closed] [1 comment]
16 Aug 2020
- error when running pod install
https://github.com/CocoaPods/CocoaPods/issues/9195 [closed] [4 comments]
04 Oct 2019
- 0.38.1: Linker errors due to incompatible semver versions
https://github.com/CocoaPods/CocoaPods/issues/3887 [closed] [10 comments]
25 Jul 2015
Error output from CocoaPods:
↳
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /Users/ashraf/Desktop/Work/App.Connect/smile_me_in in PATH, mode 040757
[!] 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
Error launching application on iPhone 11 Pro Max.
You should uncomment your profile ios target.
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
If it also doesn't work. You need to check your target device's minimum support os version.
Go to the ios/Pods/Local Podspecs folder of your flutter application, check the highest ios platform target required by each Podspec then go to ios/Podfile, uncomment the line that defines the ios platform target and change it to the highest found in your Podspec
I have a web view on my flutter project. Inside web view widget i am checking location permission with permission handler like below:
void _checkLocationPermission() async {
if (await Permission.location.request().isGranted) {
Position position = await getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
if (position == null) {
latitude = "";
longitude = "";
} else {
latitude = position.latitude.toString();
longitude = position.longitude.toString();
}
setState(() {
isPermission = true;
});
}
}
In Info.plist i added these permissions:
<key>NSLocationAlwaysUsageDescription</key>
<string>Needed to access location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Needed to access location</string>
And this is podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
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
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=0'
]
end
end
end
I commented default post install :
#post_install do |installer|
# installer.pods_project.targets.each do |target|
# flutter_additional_ios_build_settings(target)
# end
#end
and I added these lines at the end of this file, according permission handler suggestion:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=0'
]
end
end
end
But when i run on my iphone 7 plus when i open my web view the permission request dialog not shown and i don't have location permission!!!
podfile is correct? Because this is a first time i added something in podfile!!!
You don't need permission handler for this,this feature is available with Location plugin checkout their official
Download and import plugin
location
Add Permission
iOS
And to use it in iOS, you have to add this permission in Info.plist :
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
For more info checkout official plugin
Initialize variables
String latitude_data;
String longitude_data;
bool _serviceEnabled;
Current Location Function
Future _getLocation() async {
Location location = new Location();
var _permissionGranted = await location.hasPermission();
_serviceEnabled = await location.serviceEnabled();
if (_permissionGranted != PermissionStatus.granted || !_serviceEnabled) {
///asks permission and enable location dialogs
_permissionGranted = await location.requestPermission();
_serviceEnabled = await location.requestService();
} else {
///Do something here
}
LocationData _currentPosition = await location.getLocation();
longitude_data=_currentPosition.longitude.toString();
latitude_data=_currentPosition.latitude.toString();
///if you want you can save data to sharedPrefrence
SharedPrefrence().setLatitude(_currentPosition.latitude.toString());
SharedPrefrence().setLongitude(_currentPosition.longitude.toString());
}
Then uninstall the app from phone,run flutter clean and run again
Actually you added the values in Podfile backwards.
You need to assign them "1" for them to be allowed. Now you have actually denied them:
'PERMISSION_LOCATION=1',
'PERMISSION_NOTIFICATIONS=1'