![](/img/trans.png)
[英]FCM detect app uninstall on IOS (firebase cloud messaging push notifications)
[英]Firebase cloud messaging (FCM) in IOS app is not working
我按照firebase网站上的文档指南进行了以下所有操作:
1.在AppDelegate.swift中实现代码。
2.将Pod添加到我的podfile中并安装。
3.在我的developer.apple帐户的“ 证书,标识符和配置文件”中创建了APN身份验证密钥,并将其粘贴到FCM设置中。
4.在项目功能中启用了推送通知(已选中两个v)。
5.创建的证书类型:Apple Push Services用于生产
我从firebase控制台发送了几条通知,但我的iPhone(IOS 10.3)没有收到任何通知。 有什么提示要检查吗? 我错过了什么?
Podfile :
use_frameworks!
# Pods for App
pod 'Firebase/Core'
pod 'Firebase/Crash'
pod 'Firebase/Messaging'
AppDelegate.swift :
import UIKit
import Firebase
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Use Firebase library to configure APIs.
FirebaseApp.configure()
if #available(iOS 10.0, *) {
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
} else {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
application.registerUserNotificationSettings(settings)
}
application.registerForRemoteNotifications()
return true
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.