Skip to content

fix(ios): allow apps to override plugin Info.plist permission strings#116

Merged
shanerbaner82 merged 1 commit into
mainfrom
fix/plugin-permissions
May 7, 2026
Merged

fix(ios): allow apps to override plugin Info.plist permission strings#116
shanerbaner82 merged 1 commit into
mainfrom
fix/plugin-permissions

Conversation

@shanerbaner82
Copy link
Copy Markdown
Contributor

@shanerbaner82 shanerbaner82 commented May 7, 2026

Summary

  • iOS plugin compiler used to silently skip Info.plist keys already present, so plugin manifest changes never reached the rendered plist on rebuild — no way to address App Store rejection emails asking for more explicit permission language without hand-editing nativephp/ios/NativePHP/Info.plist.
  • It also meant when multiple plugins claim the same key (e.g. mobile-camera and mobile-scanner both set NSCameraUsageDescription), plugin order silently picked the winner with no app-level recourse.

What changed

  • IOSPluginCompiler::injectPlistEntries now updates existing string/array values instead of skipping them. Plugin manifests stay the source of truth across rebuilds.
  • New permissions block in config/nativephp.php. Anything set there is applied as the final layer after all plugins, giving the app developer the last word:
    'permissions' => [
        'NSCameraUsageDescription' => 'Used to take a profile photo.',
        'NSMicrophoneUsageDescription' => 'Used to record audio with your videos.',
    ],
  • Replaced the test that locked in the skip behavior; added coverage for the app-level override path.

Android isn't included — its permission rationale is shown by app code at runtime, not declared in the manifest, so there's no equivalent to override.

Test plan

  • vendor/bin/phpunit --filter "IOSCompilerTest|AndroidCompilerTest|PluginManifest|PluginRegistry|PluginDiscovery" — 90 tests pass
  • Manual: in an app with conflicting plugins (mobile-camera + mobile-scanner), set NSCameraUsageDescription in config/nativephp.php permissions block, rebuild iOS, verify nativephp/ios/NativePHP/Info.plist and NativePHP-simulator-Info.plist both pick up the override.
  • Manual: with no app-level override, verify the plugin's manifest value still lands (now updates on rebuild instead of going stale).

🤖 Generated with Claude Code

The iOS plugin compiler used to silently skip Info.plist keys that were
already present, which meant once a usage description string landed in
the plist (e.g. NSCameraUsageDescription from a plugin manifest), no
later edit would ever reach the rendered plist. App Store rejections
asking for more explicit permission language couldn't be addressed
without manually editing nativephp/ios/NativePHP/Info.plist.

It also exposed a second problem: when multiple plugins claim the same
key (mobile-camera + mobile-scanner both set NSCameraUsageDescription),
plugin order silently decided the winner with no way for the app to
intervene.

Changes:
- IOSPluginCompiler::injectPlistEntries now updates existing string and
  array values instead of skipping them, so plugin manifests stay the
  source of truth across rebuilds.
- New 'permissions' block in config/nativephp.php. Anything set here is
  applied as the final layer over all plugins, giving the app developer
  the last word — useful for resolving multi-plugin key collisions and
  for shipping App-Store-ready language without forking a plugin.
- Tests updated: replaced the test that locked in the skip behavior,
  added coverage for the app-level override path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shanerbaner82 shanerbaner82 merged commit 13b8bc0 into main May 7, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant