0
Google Firebase Messaging 시스템으로 (성공적으로) 재생되었습니다. 내 iPhone으로 메시지를 보내고 그룹/주제에 가입/탈퇴 할 수 있습니다. 이제 푸시 알림이 휴대 전화에 도착하면이를 관리하고 처리하려고합니다. Google Firebase Messaging - Swift에서 푸시 알림 분석 3
// Receive displayed notifications for iOS 10 devices.
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
// Print message ID.
if let messageID = userInfo[gcmMessageIDKey] {
print("1 Message ID: \(messageID)")
}
// Print full message.
print(userInfo)
// Change this to your preferred presentation option
completionHandler([])
}
이
이 구글에서 기본 코드와 푸시 알림 앱이보고 인쇄 도착할 때 나는 그것을 잘 작동합니다 : 나는 다양한 스위프트 3 JSON 처리 도구를 사용하려고 할 때
1 Message ID: 0:1007%4xxxxxxxxxa
[AnyHashable("gcm.message_id"): 0:1007%4xxxxxa, AnyHashable("aps"): {
alert = {
body = "Breaking News: ";
title = "The latest update";
};
category = "http://amp.sportsmole.co.uk/football/";
}]
나는 실수로 끝난다. 예를 들어
내가하려고하면 :
let data = userInfo[gcmMessageIDKey]
let json = try? JSONSerialization.jsonObject(with: data, options: [])
내가 인수의 형태로 된 JSONObject는 내가 필요로 무엇 아니라고 오류가 발생합니다.
통찰력이 있으십니까? 이 재생 일부 후
일부 재생 후이 작동하는 것 같습니다. –