Firebase Cloud Message iOS Swift无法正常工作 [英] Firebase Cloud Message iOS Swift not working

查看:41
本文介绍了Firebase Cloud Message iOS Swift无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个iOS Swift应用.第一个已经存在于App Store中,假设它称为"ExistingStoreApp".我创建的第二个应用程序仅用于通过Firebase Cloud Messaging(FCM)测试推送通知,我将其称为"PushyTestApp".

我不明白的是:通过Firebase-Console发送推送通知->通知仅在PushyTestApp中有效,但不适用于ExistingStoreApp,尽管我在ExistingStoreApp上执行了相同的过程以使Firebase运行.我做了以下事情:

  1. 在Apple Dev中创建APNs AuthenticationKey.控制台( https://firebase.google.com/docs/cloud-messaging/ios/certs )
  2. 使用显式Bundle-ID创建App ID(此处ExistingStoreApp和PushyTestApp之间存在差异:ExistingStoreApp-App-ID已存在)
  3. 创建配置文件
  4. 创建应用(差异:ExistingStoreApp已经存在)
  5. 添加带有Pod"Firebase/Core"的CocoaPods&pod'Firebase/Messaging'-> pod install( https://firebase.google.com/docs/cloud-messaging/ios/client )
  6. 在Xcode应用程序功能中:推送通知处于打开状态,后台模式下的远程通知处于打开状态
  7. 使用现有的Firebase-Project(正在运行的Android)并添加新的iOS应用
  8. 将APN AuthKey上载到Firebase-Project-App
  9. 下载GoogleService-Info.plist->添加到XCODE源目录
  10. 使用示例代码( https填充AppDelegate.swift.://github.com/firebase/quickstart-ios/blob/master/messaging/MessagingExamapleSwift/AppDelegate.swift )
  11. 通过Firebase-Console发送消息,优先级:高

结果:PushyTestApp成功连接到Firebase,获得FCM-Token,在XCODE控制台中显示消息内容.ExistingStoreApp已成功连接到Firebase,使用Firebase-Console发送消息时获得了FCM-Token,无反应.

我没有禁用Method Sizzling.我错过了哪一部分?我以为这不是传统的Bundle-ID("My-Company.My-Appname"),而是与PushyTestApp一起使用的类似Bundle-ID.是因为ExistingStoreApp已经是分布式App,PushyTestApp还是开发中?

解决方案

好吧,这是最奇怪的解决方案:放弃了几乎所有的战斗,我将包含Firebase的App-Update上传到了包含Firebase的App Store中.AppStore告诉我更新我的1024pt App-Icon.我进行了更改,在XCode的Media.xcassets中环顾四周,发现没有定义通知的图标.添加了它们,然后再次上传到App Store.

我上次尝试通过Firebase-Console和 bing 再次发送消息:在iPhone上收到的消息.无语.

希望有人在发疯之前先帮忙

I got two iOS Swift Apps. The first one already exists in the App Store, let's say it is called "ExistingStoreApp". The second App I created only to test Push-Notifications with Firebase Cloud Messaging (FCM), I call it "PushyTestApp".

What I do not understand: Sending Push-Notifications via Firebase-Console -> Notifications only works in PushyTestApp, but not with the ExistingStoreApp, although i did the same procedure on my ExistingStoreApp to make Firebase run. I did the following:

  1. Create APNs AuthenticationKey in Apple Dev. Console (https://firebase.google.com/docs/cloud-messaging/ios/certs)
  2. Create App ID with explicit Bundle-ID (Difference between ExistingStoreApp and PushyTestApp here: ExistingStoreApp-App-ID already exists)
  3. Create Provisioning-Profile
  4. Create App (difference: ExistingStoreApp already exists)
  5. Add CocoaPods with pod 'Firebase/Core' & pod 'Firebase/Messaging' -> pod install (https://firebase.google.com/docs/cloud-messaging/ios/client)
  6. In Xcode App-Capabilities: Push Notifications turn ON, Remote Notifications under Background Modes turn ON
  7. Use Existing Firebase-Project (Android running and working) and add new iOS App
  8. Upload APN AuthKey to Firebase-Project-App
  9. Download GoogleService-Info.plist -> Add to XCODE-Source dir
  10. Fill AppDelegate.swift with example Code (https://github.com/firebase/quickstart-ios/blob/master/messaging/MessagingExamapleSwift/AppDelegate.swift)
  11. Send Message via Firebase-Console with priority: high

result: PushyTestApp connected successful to Firebase, got FCM-Token, shows Message-content in XCODE-console. ExistingStoreApp connected successful to Firebase, got FCM-Token, no reaction when sending message with Firebase-Console.

I did not disable Method Sizzling. Which part did I miss? I thought it would be the Bundle-ID which is not conventional ("My-Company.My-Appname") but a similar Bundle-ID worked with PushyTestApp. Is it because the ExistingStoreApp is already a distributed App, an PushyTestApp is Development?

解决方案

Ok, here comes the most strangest solution: Giving almost up the fight, I uploaded my App-Update to the App-Store with Firebase in code included. The AppStore told me to update my 1024pt App-Icon. I changed it, looked around in my Media.xcassets in XCode and spotted, that I had no icons for notifications defined. Added them, uploaded again to App-Store.

I tried one last time to send again a msg over Firebase-Console and bing: Message received on iPhone. speechless.

Hope somebody helps this before going berserk

这篇关于Firebase Cloud Message iOS Swift无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆