FIRMessagingDelegate's的消息:didReceiveMessage:没有实现 - 火力地堡4.1.1 - 斯威夫特3
问题描述:
我升级火力地堡从v3
到v4
但我必须在接收消息的一些问题,我得到这样的警告:FIRMessagingDelegate's的消息:didReceiveMessage:没有实现 - 火力地堡4.1.1 - 斯威夫特3
[火力地堡/消息] [I-FCM002019] FIRMessaging接收的数据的消息,但FIRMessagingDelegate's的消息:didReceiveMessage:没有实现
我知道应该实现此方法:
public func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage){
print(remoteMessage.appData)
//let title = remoteMessage.appData[("data"): {"title"}]
var title = "New Request"
for value in remoteMessage.appData{
if let value = value as? [AnyHashable:Any]{
print(value)
}
}
let message = "okay"
print(message)
self.showAlertAppDelegate(title: title ,message:message ,buttonTitle:"ok",window:self.window!)
print(title, message)
}
但我仍然有警告,所以有什么行动我应该做更多?
答
我发现这个问题,这是我忘记这个线
Messaging.messaging().delegate = self
在该方法中:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {}