Xcode 12推送通知开关为空、12.1添加能力按钮异常求助
Fixes for Push Notification Issues in Xcode 12 & 12.1
Hey there, I’ve run into both of these exact issues with Xcode 12 and 12.1 before—super frustrating, right? Let me share the fixes that worked for me and other fellow developers:
Issue 1: Empty Push Notification Toggle in Xcode 12
Here’s what resolved this for me:
- First, double-check that your Apple Developer account has Push Notification permissions enabled, and your project’s Bundle ID has the Push Notifications service turned on in the Apple Developer后台
- Clean your project and build folder: use
Cmd + Shift + Kto clean the project, thenCmd + Option + Shift + Kto wipe the build folder - Quit Xcode entirely, restart your Mac, then reopen the project and check the Capabilities tab again
- If the toggle is still empty, manually edit your project’s
.entitlementsfile: add theaps-environmentkey, and set its value todevelopment(for testing) orproduction(for release builds)
Issue 2: Hidden Push Notification Button & Disabled Capability in Xcode 12.1
This is likely a Xcode bug or signing configuration conflict—try these steps:
- Make sure you’ve selected the correct development team in the Signing & Capabilities tab of your project target. If no team is selected, pick your team first before adding capabilities
- Try manually adding the capability: Right-click your
.xcodeprojfile, select "Show Package Contents", open theproject.pbxprojfile with a text editor, and search forcom.apple.PushNotification. If it’s missing, add it to the relevant Capabilities section of your target - Delete your project’s Derived Data folder (located at
~/Library/Developer/Xcode/DerivedData/), quit Xcode, then reopen and try adding the Push Notification capability again - If the capability remains disabled after adding, head to the Apple Developer backend to confirm Push Notifications is enabled for your Bundle ID. Then download the latest Provisioning Profile and import it into Xcode, or let Xcode automatically manage signing to refresh the profile
Hope these solutions get your push notifications working smoothly again!
内容的提问来源于stack exchange,提问作者Kefah.b
相关产品推荐
相关产品推荐

