fix(ios): allow apps to override plugin Info.plist permission strings#116
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nativephp/ios/NativePHP/Info.plist.mobile-cameraandmobile-scannerboth setNSCameraUsageDescription), plugin order silently picked the winner with no app-level recourse.What changed
IOSPluginCompiler::injectPlistEntriesnow updates existing string/array values instead of skipping them. Plugin manifests stay the source of truth across rebuilds.permissionsblock inconfig/nativephp.php. Anything set there is applied as the final layer after all plugins, giving the app developer the last word: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 passmobile-camera+mobile-scanner), setNSCameraUsageDescriptioninconfig/nativephp.phppermissionsblock, rebuild iOS, verifynativephp/ios/NativePHP/Info.plistandNativePHP-simulator-Info.plistboth pick up the override.🤖 Generated with Claude Code