title: Flutter: Add location permission on IOS in permission handler
body: <p>I have a web view on my flutter project. Inside web view widget i am checking location permission with permission handler like below:</p>
  <pre><code>  void _checkLocationPermission() async {
      if (await Permission.location.request().isGranted) {
        Position position = await getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
        if (position == null) {
          latitude = &quot;&quot;;
          longitude = &quot;&quot;;
        } else {
          latitude = position.latitude.toString();
          longitude = position.longitude.toString();
        }
        setState(() {
          isPermission = true;
        });
      }
    }
  </code></pre>
  <p>In Info.plist i added these permissions:</p>
  <pre><code>&lt;key&gt;NSLocationAlwaysUsageDescription&lt;/key&gt;
  &lt;string&gt;Needed to access location&lt;/string&gt;
  &lt;key&gt;NSLocationWhenInUseUsageDescription&lt;/key&gt;
  &lt;string&gt;Needed to access location&lt;/string&gt;
  </code></pre>
  <p>And this is podfile:</p>
  <pre><code># 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' =&gt; :debug,
    'Profile' =&gt; :release,
    'Release' =&gt; :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 &quot;#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first&quot;
    end
  
    File.foreach(generated_xcode_build_settings_path) do |line|
      matches = line.match(/FLUTTER_ROOT\=(.*)/)
      return matches[1].strip if matches
    end
    raise &quot;FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get&quot;
  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
  </code></pre>
  <p>I commented default post install :</p>
  <pre><code>#post_install do |installer|
  #  installer.pods_project.targets.each do |target|
  #    flutter_additional_ios_build_settings(target)
  #  end
  #end
  </code></pre>
  <p>and I added these lines at the end of this file, according permission handler <a href="https://pub.dev/packages/permission_handler" rel="nofollow noreferrer">suggestion</a>:</p>
  <pre><code>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
  </code></pre>
  <p>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!!!</p>
  <p>podfile is correct? Because this is a first time i added something in podfile!!!</p>