expo-no-push-entitlement
v1.0.0
Published
Expo config plugin that removes the iOS aps-environment entitlement so apps using only local notifications can be signed by a personal Apple development team.
Downloads
152
Maintainers
Readme
expo-no-push-entitlement
Expo config plugin that removes the iOS aps-environment entitlement.
expo-notifications adds aps-environment to your entitlements unconditionally, even when your app only schedules local notifications and never registers for remote push. That entitlement is the Push Notifications capability, and a personal Apple development team cannot provision it, so expo prebuild followed by a local build fails to sign:
Cannot create a iOS App Development provisioning profile for "com.example.app".
Personal development teams, including "Your Name", do not support the
Push Notifications capability.Local notifications need no entitlement. This plugin deletes the key so a personal team can sign the app.
Install
npm install --save-dev expo-no-push-entitlementUsage
Add it to plugins in your app config. It must come before expo-notifications.
{
"expo": {
"plugins": [
"expo-no-push-entitlement",
["expo-notifications", { "enableBackgroundRemoteNotifications": false }]
]
}
}Then regenerate:
npx expo prebuild -p ios --clean
plutil -p ios/YourApp/YourApp.entitlements # => {}Why the order looks backwards
Expo config plugin mods wrap each other, so the plugin registered last runs first. Listing this plugin after expo-notifications makes it run before the entitlement is added — it deletes nothing, and expo-notifications then adds the key:
before: {} ← ran too early
after: {} ← entitlement still ends up in the buildRegistering it first makes its mod run last:
before: {"aps-environment":"development"}
after: {}This matters because expo-notifications only writes the key when it is absent (if (!config.modResults['aps-environment'])), so deleting it beforehand accomplishes nothing.
When not to use this
Do not use this if your app registers for remote push (getExpoPushToken, getDevicePushToken, or any APNs token listener). Removing the entitlement breaks remote push. It is intended for apps that only call scheduleNotificationAsync and friends.
Remote push requires a paid Apple Developer account regardless; a personal team cannot provision it at all.
Background
- expo/expo#18951 — Ability to disable Push Notification entitlements by default
- expo/expo#27668 — Push Notifications entitlement getting added automatically in prebuild
- expo/eas-cli#987 — Push Notifications Entitlement turned on even when selecting "no"
License
MIT
