我在IOS设备上使用Firebase推送通知时遇到问题.我从firebase控制台发送消息,我在日志中得到它,但它没有在我尝试过的设备上显示任何通知.
我一直在寻找有类似问题的帖子,我已经尝试了我找到的所有内容,但它仍然无效.
我在firebase上创建了项目,下载了google服务信息文件并将其放在项目的根目录上,在xcode上打开通知,将消息的优先级设置为高,并进行了一些更改.
我还在podfile中添加了"Firebase/Core"和"Firebase/Messaging".
现在我正在使用Firebase为您提供的示例.这是我的代码.
import UIKit
import UserNotifications
import Firebase
import FirebaseInstanceID
import FirebaseMessaging
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let gcmMessageIDKey = "gcm.message_id"
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Register for remote notifications. This shows a permission dialog on first run, to
// show the dialog at a more appropriate time move this registration accordingly.
// [START register_for_notifications]
if #available(iOS 10.0, *) {
// For iOS 10 display notification …Run Code Online (Sandbox Code Playgroud)