xcode 我是否需要将 Entitlements.plist 文件设置为我的目标才能使推送通知工作?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31311809/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:26:47  来源:igfitidea点击:

Do I need to set an Entitlements.plist file to my target to make Push Notifications work?

iosxcodeapple-push-notificationscode-signingentitlements

提问by AppsDev

I'm having a lot of problems trying to configure Push Notifications that I don't understand and I explained in this post. I think I did all I have to do: creating APNS certificates, enabling Push services in App ID, and creating associated provisioning profiles with Push Notifications enabled. All seems to be ok at my Member Center. But this does not work in Xcode, Xcode is not showing me any aps entitlement anywhere... Could it be because in Build Settings > Code Signing > Code Signing Entitlements I have nothing? What should I put there?

我在尝试配置推送通知时遇到了很多我不理解的问题,我在这篇文章中进行了解释。我想我已经完成了所有我需要做的事情:创建 APNS 证书,在 App ID 中启用推送服务,以及在启用推送通知的情况下创建关联的配置文件。我的会员中心似乎一切正常。但这在 Xcode 中不起作用,Xcode 没有在任何地方向我显示任何 aps 权利......难道是因为在 Build Settings > Code Signing > Code Signing Entitlements 中我什么都没有?我应该在那里放什么?

Thanks in advance

提前致谢

回答by Durai Amuthan.H

The direct answer is Yes.

直接的答案是肯定的。

If you are using push notifications then it has to be added in Entitlements.plist or else app can't be installed in latest iOS versions.

如果您使用推送通知,则必须将其添加到 Entitlements.plist 中,否则无法在最新的 iOS 版本中安装应用程序。

enter image description here

在此处输入图片说明

Other than enabling push notification in your provisioning profileyou have to enable it on xcode capabilitieswhich deals with Entitlements.plist

除了在您的配置文件中启用推送通知之外,您还必须在处理 Entitlements.plist 的xcode 功能上启用它