【发布时间】:2015-06-10 07:47:58
【问题描述】:
来自https://developers.google.com/games/services/ios/notifications 我发现了这个,它可能是解决方案。我还没有在我的 Xcode 中实现这个(因为我不知道我是如何实现的,或者我是否真的需要)。所以我的问题是:我是否应该尝试在我的 xcode 中获取此代码以及如何获取?
4.接下来,注册您的应用以在用户成功登录后接收推送通知。在您的finishedWithAuth:error 处理程序中添加以下代码,此时用户已成功登录到Google Play 游戏服务。这会打开标准的 iOS 推送通知对话框。如果您的游戏已经通过在别处实现此代码注册了推送通知,那么您无需再次添加此行。
[[UIApplication sharedApplication] registerForRemoteNotifications:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert)];
5.在您的 appDelegate 中,将以下代码添加到回调中,以检索从 APNS 传回的推送设备令牌。此设备令牌用于出站推送通知,您的应用必须将其注册到 Google Play 游戏服务推送服务。确保始终通过 GPGManager 注册您的设备令牌,以启用来自 Google Play 游戏服务的推送通知。即使用户没有登录; GPGmanager 对象将缓存此令牌并保存它直到用户登录。
(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken :(NSData *)deviceToken { NSLog(@"Got deviceToken from APNS! %@", deviceToken); [[GPGManager sharedInstance] registerDeviceToken:deviceToken forEnvironment:GPGPushNotificationEnvironmentSandbox]; }
【问题讨论】:
-
你当前的代码在哪里,问题到底出在哪里?
-
我用 c# 统一编写了所有代码,然后导出为 xcode 项目。然后我内置了 xcode 并在我的 ipad 上运行它。我从来没有在 xcode 中写过一行代码......问题是应用程序没有收到任何推送通知。 xcode 调试器在收到推送通知时什么也不显示。意思是我的应用确实有一个事件意识到有一个进来......所以调试器没有错误消息......
标签: unity3d push-notification google-play-games