我正在尝试将Firebase云消息传递与一个用Libgdx编写并通过RoboVM-robopods桥接到iOS的游戏绑定。
当我配置Firebase控制台和我的应用程序时,我记得我收到了一些测试通知。突然之后,它已经坏了。
//this code prints console the device token which is working right now.
@Override
public void didRegisterForRemoteNotifications(UIApplication application, NSData deviceToken) {
super.didRegisterForRemoteNotifications(application, deviceToken);
System.out.println("didRegisterForRemoteNotifications");
System.out.println("didRegisterForRemoteNotifications");
System.out.println("deviceToken="+deviceToken.toString());
Application.firebaseToken = deviceToken.description();
System.out.println("didRegisterForRemoteNotifications");
//TODO send token to server.
FIRMessaging.messaging().setAPNSToken(deviceToken);
}
//robovm.xml frameworks which is imported from
<frameworks>
<framework>UIKit</framework>
<framework>OpenGLES</framework>
<framework>QuartzCore</framework>
<framework>CoreGraphics</framework>
<framework>OpenAL</framework>
<framework>AudioToolbox</framework>
<framework>AVFoundation</framework>
<framework>CoreMotion</framework>
<framework>SafariServices</framework>
<framework>StoreKit</framework>
<framework>AdSupport</framework>
<framework>WebKit</framework>
<framework>MobileCoreServices</framework>
<framework>SystemConfiguration</framework>
<framework>GoogleMobileAds</framework>
<framework>GoogleToolboxForMac</framework>
<framework>FirebaseMessaging</framework>
<framework>Protobuf</framework>
<framework>FIRAnalyticsConnector</framework>
<framework>FirebaseAnalytics</framework>
<framework>FirebaseCore</framework>
<framework>FirebaseCoreDiagnostics</framework>
<framework>FirebaseInstanceID</framework>
<framework>GoogleAppMeasurement</framework>
<framework>GoogleUtilities</framework>
<framework>nanopb</framework>
</frameworks>
//info.plist.xml
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true />
</dict>
我还在info.plist中将代理设置为true和false,并且没有任何改变。
These are console outputs.
2019-08-06 21:02:26.955004+0300 IOSLauncher[20268:5178455] 5.16.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
dNp9FV6zuvc:APA91bFU5PlSEPv1lc_ErxI5NCiP4iCddCUKpoaDN6h7cZ44iLze0qYGVLenTYaWbqW6z0dpJVok60rf1Ce9nc1pSP-32Rvb2jZQZlyhLhhuaEdmfql4Zp6LaqbYBepe8EOraowLczbO
dNp9FV6zuvc:APA91bFU5PlSEPv1lc_ErxI5NCiP4iCddCUKpoaDN6h7cZ44iLze0qYGVLenTYaWbqW6z0dpJVok60rf1Ce9nc1pSP-32Rvb2jZQZlyhLhhuaEdmfql4Zp6LaqbYBepe8EOraowLczbO
dNp9FV6zuvc:APA91bFU5PlSEPv1lc_ErxI5NCiP4iCddCUKpoaDN6h7cZ44iLze0qYGVLenTYaWbqW6z0dpJVok60rf1Ce9nc1pSP-32Rvb2jZQZlyhLhhuaEdmfql4Zp6LaqbYBepe8EOraowLczbO
dNp9FV6zuvc:APA91bFU5PlSEPv1lc_ErxI5NCiP4iCddCUKpoaDN6h7cZ44iLze0qYGVLenTYaWbqW6z0dpJVok60rf1Ce9nc1pSP-32Rvb2jZQZlyhLhhuaEdmfql4Zp6LaqbYBepe8EOraowLczbO
dNp9FV6zuvc:APA91bFU5PlSEPv1lc_ErxI5NCiP4iCddCUKpoaDN6h7cZ44iLze0qYGVLenTYaWbqW6z0dpJVok60rf1Ce9nc1pSP-32Rvb2jZQZlyhLhhuaEdmfql4Zp6LaqbYBepe8EOraowLczbO
didRegisterForRemoteNotifications
didRegisterForRemoteNotifications
deviceToken=<74aa6f4b ea15e94f 4fe88663 a667eaec 9388bd5e ec506920 2ae5d686 ecbcc23f>
didRegisterForRemoteNotifications
另外,当我按下主页按钮并重新打开应用程序时,它会显示一些类似的输出
The operation couldn’t be completed. FIRMessaging is already connected
Error Domain=com.google.fcm Code=2001 "FIRMessaging is already connected" UserInfo={NSLocalizedFailureReason=FIRMessaging is already connected}
Error Domain=com.google.fcm Code=2001 "FIRMessaging is already connected" UserInfo={NSLocalizedFailureReason=FIRMessaging is already connected}