简体   繁体   English

无法在 Xcode 13 中将推送通知添加到调试

[英]Cannot add Push Notifications to Debug in Xcode 13

I get the following error in the console when running the app:运行应用程序时,我在控制台中收到以下错误:

[Firebase/Messaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: no valid “aps-environment” entitlement string found for application

In Capabilities I have added "Push Notifications" but it only seems to be added to the Release build.在功能中,我添加了“推送通知”,但它似乎只被添加到发布版本中。 In "All" it says Push Notifications (Release) If I go to the Debug tab and add Capabilities, I can see Push Notifications;在“全部”中它显示Push Notifications (Release)如果我 go 到调试选项卡并添加功能,我可以看到推送通知; however, if I double click it or drag it in, nothing happens.但是,如果我双击它或将其拖入,则没有任何反应。 It does not add nor show and there is no error thrown.它既不添加也不显示,也没有抛出任何错误。

I presume the error I receive in the console is due to the missing capability for debug which I cannot seem to add unlike for release.我认为我在控制台中收到的错误是由于缺少调试功能,我似乎无法添加与发布不同的功能。 Remote notifications are also checked in the "Background Modes" section.远程通知也在“后台模式”部分进行检查。

i had also this problem.我也有这个问题。 I HAVE SOME WORK AROUND FOR THIS.. NOT SURE HOW ITS WORK IN PRODACTION.我对此有一些解决方法..不确定它在生产中是如何工作的。 what i did is copy the entitlements file and change is name from testRelease.entitlements to test.entitlements我所做的是复制权利文件并将名称从 testRelease.entitlements 更改为 test.entitlements

test is the name of app test 是应用程序的名称

Opening up Xcode, and go to the Project Properties > Build Settings > Code Signing Entitlements > Ensure the name of the entitlement file should be the same for 'Both Debug and Release Configuration'.打开 Xcode 和 go 到项目属性 > 构建设置 > 代码签名授权 >确保授权文件的名称对于“调试和发布配置”应该相同。 For Example... $(SRCROOT)/$(PRODUCT_NAME)/$(PRODUCT_NAME).entitlements PRODUCT_NAME is your target name.例如... $(SRCROOT)/$(PRODUCT_NAME)/$(PRODUCT_NAME).entitlements PRODUCT_NAME 是您的目标名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM