79553846

Date: 2025-04-03 19:41:30
Score: 0.5
Natty:
Report link

it's not redundancy—it’s two separate steps required by iOS for different reasons.

The two places where permissions are defined serve different purposes in iOS development, and this is not Flutter-specific—it's how iOS handles permissions at both runtime and compile-time.

1. Info.plist – Declaring Permissions for iOS
Purpose: This is required by iOS to display permission prompts to users.

How it works: When an app requests access to a feature (e.g., location, camera, microphone), iOS checks Info.plist for the corresponding usage description.

Example:


<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We need your location to improve recommendations.</string>

Without this: The app will crash when requesting a permission because iOS enforces explicit usage descriptions.

2. Podfile – Configuring iOS Dependencies (Compile-Time)
Purpose: Some dependencies (like permission_handler) use preprocessor flags to enable/disable specific permissions at compile time.

Why? iOS apps must only include permissions they actually use, or Apple may reject the app.

Example:


post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        'PERMISSION_LOCATION=1',
      ]
    end
  end
end

How it works:

This tells the permission_handler plugin to include location permissions in the app.

If you omit this, iOS might strip out permission-related code, causing the permission request to fail at runtime.

Hope this information clears your doubt.

Reasons:
  • Blacklisted phrase (0.5): Why?
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Harsh Jani