Skip to content

Swift Package manager iisue #1544

Open
Open

Description

@lahteefmitco

Noit supporting Swift Package manager in flutter version 3.44. please solve it

Activity

  1. jendas1 commented on Jun 13, 2026

    @jendas1

    Facing the same issue which creates problem with the flutter workflow. Now CocoaPods are deprecated by flutter (as mentioned here: https://docs.flutter.dev/add-to-app/ios/project-setup ).

  2. daniJimen commented on Jun 22, 2026

    @daniJimen

    The problem is that SPM support was updated in permission_handler_apple 9.4.10. However, permission_handler 12.0.3 still does not reference the latest version of permission_handler_apple, so those SPM updates are not included in the current release of permission_handler.

  3. lyio commented on Jun 23, 2026

    @lyio

    @daniJimen is that a simple version bump or does the update require changes?

  4. Pachebel commented on Jun 23, 2026

    @Pachebel
    Contributor

    Guys, I have fixed this "issue" removing any permissions I have made previously on Podfile. Here is some sort of step-by-step guide:

    1. Upgrade Flutter Packages

    To ensure you have the SPM-compatible version of the Apple permission handler, you need to upgrade your packages.

    flutter pub upgrade

    (Ensure permission_handler_apple updates to version 9.4.10 or higher).

    2. Remove Old CocoaPods Configurations from Podfile

    With SPM, Package.swift automatically detects which permissions to enable by reading the keys present in your app's ios/Runner/Info.plist. You no longer need to manually inject C macros in the Podfile.

    Open ios/Podfile and remove the entire GCC_PREPROCESSOR_DEFINITIONS block associated with permissions.

    Remove this block (if present):

    # Remove these lines from your post_install loop
    config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
      '$(inherited)',
      'PERMISSION_CAMERA=1',
      'PERMISSION_PHOTOS=1',
      'PERMISSION_LOCATION=1',
      'PERMISSION_NOTIFICATIONS=0',
      # ... and any other PERMISSION_ macros
    ]

    3. Opt-out of Default Permissions (Notifications / Critical Alerts)

    Since PermissionGroup.notification has no required Info.plist key, it is enabled by default. If your app does not use notifications (previously PERMISSION_NOTIFICATIONS=0), you now must disable it via an environment variable before building.

    In the terminal:

    export PERMISSION_NOTIFICATIONS=0
    flutter build ios

    4. Clear Xcode Derived Data

    After changing package versions or modifying your Podfile, Xcode needs to completely re-evaluate the dependency tree and Package.swift.

    Clear your Xcode cache using:

    rm -rf ~/Library/Developer/Xcode/DerivedData

    5. Re-sync CocoaPods Dependencies

    Because flutter pub upgrade might have updated plugins that have native iOS SDK dependencies (like Firebase), your Podfile.lock may now be out of sync. You need to delete it and force CocoaPods to fetch the updated iOS dependencies.

    cd ios
    rm -f Podfile.lock
    pod install --repo-update
    cd ..

    6. Build the App

    Finally, trigger a new clean build:

    flutter clean
    flutter build ios

    Before:

    permission_handler_apple still shows as not supported.

    Image

    After:

    permission_handler_apple is supported .

    Image

    Note: this covers the standard single-Info.plist setup. Flavor-based projects are tracked separately in #1548.

  5. quangkhaidam93 commented on Jun 28, 2026

    @quangkhaidam93

    It works perfectly. Thank a lot @Pachebel

  6. tazan83 commented on Jul 2, 2026

    @tazan83

    Versions: Flutter 3.44.4, permission_handler_apple 9.4.10

    I am still experiencing this issue when using multiple Info.plist files separated by build configurations (e.g., Info-Debug.plist and Info-Release.plist) instead of the default Info.plist.

    It seems the plugin fails to detect the required permission keys because it only searches for the hardcoded ios/Runner/Info.plist path during the build time.

    Could you guide me on how to properly configure the plugin when using custom Info.plist names or a multi-flavor setup?

    Thank you!

  7. RockyJT215 commented on Jul 20, 2026

    @RockyJT215

    Same issue here with a completely clean Flutter project — Podfile has zero GCC_PREPROCESSOR_DEFINITIONS or permission-related configuration.

    Environment

    • Flutter 3.44.2
    • permission_handler 12.0.3
    • permission_handler_apple 9.4.10
    • Xcode 26.0 beta / macOS 26
    • swift_package_manager_enabled: ios: true

    Root Cause

    findInfoPlist() in Package.swift returns an empty dictionary during SPM build. I verified this by adding #error "PERMISSION_PHOTOS is DISABLED" before the macro guard in PhotoPermissionStrategy.m — the build failed, confirming the macro was 0.

    Neither #file nor FileManager.default.currentDirectoryPath resolves to a path that can walk up to the project root containing pubspec.yaml + ios/Runner/Info.plist. All PERMISSION_* macros default to "0", every strategy compiles as an UnknownPermissionStrategy stub, and PHPhotoLibrary.requestAuthorization is never called → iOS never registers the permission → no Photos toggle in Settings.

    Scope

    Not just Photos — PERMISSION_CAMERA, PERMISSION_MICROPHONE, and PERMISSION_BLUETOOTH are all affected (confirmed via #error in all three strategies).

    Workaround

    launchctl setenv PERMISSION_PHOTOS 1
    launchctl setenv PERMISSION_CAMERA 1
    launchctl setenv PERMISSION_MICROPHONE 1
    launchctl setenv PERMISSION_BLUETOOTH 1
    # ... etc for all needed permissions
    Then restart Xcode and rebuild. Works reliably but is fragile for teams.
    
    Would be great to have a fallback mechanism — e.g. an xcconfig-style file or an explicit plist path override — so findInfoPlist() doesn't silently fail in this scenario.
  8. Mahfa commented on Jul 20, 2026

    @Mahfa

    @RockyJT215 had the same issue , @Pachebel answer solved it for me

  9. Pachebel commented on Aug 11, 2026

    @Pachebel
    Contributor

    Hi everyone!

    The flavors part (and a few smaller issues) should be fixed in my latest two PRs: #1553 and #1554.
    Please try permission_handler_apple 9.6.0 and let me know if you find any problems.

    If everything runs fine, I think this issue can be closed.

  10. deandreamatias commented on Aug 13, 2026

    @deandreamatias
    Contributor

    For me the version 9.6.0 solved the bugs. I sent a version to iOS and I not received the email with ITMS-90683

  11. deandreamatias commented on Aug 13, 2026

    @deandreamatias
    Contributor

    @lahteefmitco please close the issue

  12. narumi147 commented on Sep 13, 2026

    @narumi147

    I also have concerns about relying on environment variables (PERMISSION_HANDLER_INFO_PLIST, PERMISSION_NOTIFICATIONS, PERMISSION_CRITICAL_ALERTS) to configure permissions.

    Using launchctl setenv makes project-specific configuration part of the user's login session. When working on multiple Flutter projects with different permission requirements, developers have to manage these values manually and restart Xcode to pick up changes. An absolute Info.plist path is also machine-specific and cannot be shared reliably through version control.

    Permission configuration should ideally live in the project, be version-controlled, and work consistently for local development and CI. Environment variables are useful as optional overrides, but they should not be required for a standard build.

    Could we have a project-scoped configuration mechanism that works directly from Xcode without requiring session-wide environment variables or manual cache clearing?

  13. jellynoone commented on Oct 6, 2026

    @jellynoone

    I had a hard time running apps and getting permissions to work.

    I run the app via VSCode's quick actions over main. My app is usually located on a deeper level.

    Running this the app just failed at runtime.

    Clearing ~/Library/Developer/Xcode/DerivedData and running from the terminal at the root of the project correctly built the app with permissions.

    It seems to me the current working directory from where the project is build is important to permissions discovery.

    Versions:

    permission_handler: "13.0.2"
    permission_handler_apple: "9.6.2"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions