, 당신이 : 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)
}
편집 , 내 이제 콘솔이 오류를 인쇄 통지를 수신한다. 그렇지 않으면 완성 처리기가 호출되지 않는다는 경고를 사용자에게주지 않을 것입니다.
완성 처리기를 호출하여 경고를 제거하고 iOS를 행복하게 만들 수 있습니다. 예를 들어,
앱을 다운로드하는 데 필요한 통지와 관련된 새로운 데이터가 없다고 아이폰 OS를 말하고있다
completionHandler(.NoData)
.
http://stackoverflow.com/a/37670233 – Shubhank
은 솔루션부터 코드를 복사하여 붙여 시도했지만 그것은 나를 ") self.tokenRefreshNotificaiton 이름"에서 오류가 프로그래머 내가 엑스 코드 7.3에있어 알려줍니다 .1 – Tim
경고를 기반으로 - github 샘플을 확인하고 https://github.com/firebase/quickstart-ios/blob/master/messaging/FCMSwift/AppDelegate.swift#L50을 구현해야합니다. – Shubhank