简体   繁体   English

如何在iOS的Google Play游戏服务中禁用推送通知权限?

[英]How to disable push notification permissions in Google Play Games Services on iOS?

I have implemented Google Play Game Services in a Unity game. 我已经在Unity游戏中实现了Google Play游戏服务。 I have got build and deploy working to iOS but I get a permissions request for push notifications on first run, and iTunes connect says my app requests push notification access. 我已经可以在iOS上进行构建和部署,但是在首次运行时收到了请求推送通知的权限请求,而iTunes connect说我的应用程序请求推送通知访问权限。

I have no need for push notifications and haven't implmented them on purpose, and have no multiplayer implemented in the game. 我不需要推送通知,也没有故意实施它们,也没有在游戏中实现多人游戏。 So I'm assuming this is an automatic thing in GPGS? 所以我假设这在GPGS中是自动的吗? Can I disable it? 我可以禁用它吗?

Thanks! 谢谢!

I have got around this now by commenting out the following lines in the file GPGSAppController.mm, which I believe register the app for notifications. 我现在通过注释文件GPGSAppController.mm中的以下行来解决此问题,我相信该行会注册该应用程序以接收通知。

/*
  // iOS 8 Notifications
  if ([application
       respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {
    [application registerUserNotificationSettings:
     [UIUserNotificationSettings
      settingsForTypes:(UIUserNotificationTypeSound |
                        UIUserNotificationTypeAlert |
                        UIUserNotificationTypeBadge)
      categories:nil]];
    [application registerForRemoteNotifications];
  } else {
    // iOS < 8 Notifications
    [application
     registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
                                         UIRemoteNotificationTypeAlert |
                                         UIRemoteNotificationTypeSound)];
  }
*/
//gpg::TryHandleNotificationFromLaunchOptions(launchOptions);
//gpg::RegisterDeviceToken(deviceToken, GPGPushNotificationEnvironmentProduction);

After testing all the GPGS features I need still work but I don't get a push notifications permission pop-up. 测试完所有GPGS功能后,我仍然需要工作,但是没有弹出通知通知权限弹出窗口。

From the docs on the GitHub page : 从GitHub 页面上的文档中:

This plugin can be disabled for building on iOS. 可以禁用此插件以在iOS上构建。 What this means is that the libraries and references originating in the GooglePlayGames namespace are excluded from the build. 这意味着将GooglePlayGames命名空间中的库和引用从构建中排除。 It does not affect code that has been written by you, such as calls to the GPGS API. 它不会影响您编写的代码,例如对GPGS API的调用。

To disable the Google Play Game Services in the iOS build, open the iOS player settings. 要在iOS版本中禁用Google Play游戏服务,请打开iOS播放器设置。 Then in the "Other Settings" panel, find the entry named "Scripting Define Symbol" and add a symbol named: NO_GPGS (case sensitive). 然后在“其他设置”面板中,找到名为“脚本定义符号”的条目,并添加名为NO_GPGS(区分大小写)的符号。

  1. Find the xxx.entitlements file in your Xcode project 在您的Xcode项目中找到xxx.entitlements文件

  2. Remove the key aps-environment 删除关键的aps-environment

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

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