[Question]: Do Xcode.app builds need PERMISSION_HANDLER_INFO_PLIST? The manifest finds my app through the plugin symlink

Aperta
#1,586 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
54/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
dart, flutter, swift

Direzione di ricerca

Read the “Builds started from Xcode.app” section in the permission_handler_apple README and the findAppRoot() comment in Package.swift; compare their discovery assumptions with the Flutter symlink setup described in the issue. Check whether the observed behavior applies to the documented setup, then update the README and comment if needed. Done when the guidance accurately explains when PERMISSION_HANDLER_INFO_PLIST is required.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Please check the following before submitting a new issue.
Please select for which platform(s) you need help
  • Android
  • iOS
  • Windows
Your question

The permission_handler_apple README section "Builds started from Xcode.app" and the findAppRoot() comment in Package.swift say that a build started from Xcode.app cannot find the app, so it needs PERMISSION_HANDLER_INFO_PLIST.

In my Flutter app, a build started from Xcode.app found the app without that variable. All the PERMISSION_* macros that match my Info.plist keys were enabled. Is the README statement about a specific setup, or must the README change?

Environment
  • permission_handler_apple 9.6.4. The README text and findAppRoot() on main are the same as in 9.6.4.
  • Flutter 3.44.9 (stable), Swift Package Manager enabled
  • Xcode 27.1
  • A normal Flutter app with flavors (not an add-to-app module)
  • No PERMISSION_* or PERMISSION_HANDLER_* value is set with launchctl setenv.
Steps
  1. Quit Xcode.
  2. Move the project's DerivedData folder and ~/Library/Caches/org.swift.swiftpm/manifests to the Trash.
  3. Open ios/Runner.xcworkspace in Xcode.app and run the app on a simulator (Debug configuration).
  4. Inspect the built Runner binary in DerivedData.
Result
  • otool -oV Runner shows instance methods for LocationPermissionStrategy (7), AudioVideoPermissionStrategy (3), PhotoPermissionStrategy (4) and NotificationPermissionStrategy (4). The strategies for permissions without an Info.plist key (ContactPermissionStrategy, BluetoothPermissionStrategy, and others) have no methods.
  • The binary contains the MISSING_WHENINUSE_PERMISSION string. This string is compiled only when PERMISSION_LOCATION is 1.
Why it works (my reading)

Flutter adds each plugin to the app as a symlink:

<app>/ios/Flutter/ephemeral/Packages/.packages/permission_handler_apple-9.6.4
  -> ~/.pub-cache/hosted/pub.dev/permission_handler_apple-9.6.4/ios/permission_handler_apple

Xcode.app appears to compile the manifest at the symlink path. The SwiftPM manifest cache on my machine has only this path for the plugin:

<app>/ios/Flutter/ephemeral/Packages/.packages/permission_handler_apple-9.6.4/Package.swift

If that is correct, #file is inside the app. Then the third start point in findAppRoot() (the #file walk-up) reaches the app root, although the working directory is / and PWD is not set.

The swift package CLI resolves the symlink to ~/.pub-cache, and from there #file cannot reach the app. So the comment "#file is canonicalised by SwiftPM" matches what I see with the CLI, but not with Xcode.app.

Questions
  1. Is the README statement about a specific setup? For example, an add-to-app module (#1572), or a Flutter version that does not add plugins as symlinks.
  2. If not, can the section say that for a normal Flutter app, Xcode.app builds find the app through the #file path, and that PERMISSION_HANDLER_INFO_PLIST is needed only when discovery fails?

I saw the symlink behavior with Xcode 27.1. I did not find SwiftPM documentation for it, so a later Xcode can change it. If you agree, I can open a PR for the README and the findAppRoot() comment.

Version

9.6.4

Lingua principale
Dart
Stelle
2.2k
Fork
984
Merge medio
4g 11h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Baseflow/flutter-permission-handler

Tutte le issue di Baseflow/flutter-permission-handler

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.