Ad

How To Fix -- IPHONEOS_DEPLOYMENT_TARGET Is Set To 8.0 When Permission Handler Already In My Podfile?

- 1 answer

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?

Ad

Answer

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
Ad
source: stackoverflow.com
Ad