Baseflow / flutter-permission-handler

Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
https://baseflow.com
MIT License
2.05k stars 858 forks source link

How to configure macros with incremental build option of podfile? #281

Open HerrNiklasRaab opened 4 years ago

HerrNiklasRaab commented 4 years ago

Hello,

I am using the incremental build option like explained here: https://github.com/FirebaseExtended/flutterfire/issues/349#issuecomment-605329947

Just wanted to ask how I should add the macros, to get it to work? This is my current attempt, but it get's rejected by the appstore.

As the comment says, it's necessary to use installer.generated_projects instead of installer.pods_project.targets.

# 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,
         :generate_multiple_pod_projects => true,
         :incremental_installation => true

post_install do |installer|
  installer.generated_projects.each do |target|  ## Must use `installer.generated_projects` instead of `installer.pods_project.targets`
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'

      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
orestesgaolin commented 4 years ago

I have the same setup and would also want to know how to achieve that. Adding GCC_PREPROCESSING_DEFINITIONS like proposed in #268 doesn't work for me also.