내 휴대 전화에서 원격 푸시 알림을 수신하려고합니다. 휴대 전화를 내 컴퓨터에 연결하고 시뮬레이터를 휴대 전화로 실행하면 Firebase 콘솔에서 보낸 알림이 정상적으로 작동합니다. 그러나, 내가 Testflight에 그것을 업로드하고 내 전화에 다운로드, 내 푸시 알림을 통해오고되지 않습니다.Firebase 푸시 알림이 전화기에서 작동하지 않지만 시뮬레이터에서 작동합니다.
내 인증서가 올바르게 업로드하고 아래에있는 내 코드는
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
override init() {
FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let notificationTypes : UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerForRemoteNotifications()
application.registerUserNotificationSettings(notificationSettings)
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
func application(application: UIApplication,
openURL url: NSURL,
sourceApplication: String?,
annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation)
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
FBSDKAppEvents.activateApp()
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
// If you are receiving a notification message while your app is in the background,
// this callback will not be fired till the user taps on the notification launching the application.
// TODO: Handle data of notification
// Print message ID.
print("Message ID: \(userInfo["gcm.message_id"]!)")
// Print full message.
print("%@", userInfo)
completionHandler(.NoData)
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
print(error)
print(error.description)
}
}
프로덕션 인증서로 푸시 알림을 테스트 할 수 있습니까? 나는 같은 문제가있다. Ad-hoc 빌드는 firebase로부터 푸시 알림을받지 않습니다. – sleepwalkerfx
btw, 스크린 샷에는 개발 인증서 만 표시됩니다. 프로덕션 SSL 인증서를 만들었습니까? – sleepwalkerfx