FB iOS nicht erhalten push-Benachrichtigungen
Ich google FB in meine app - " google-Konto erstellen, erstellen Sie die google app, hochladen APNS Zertifizierungen (.pem und in der Arbeit in einem anderen service), und senden Sie push-Benachrichtigungen von der Konsole, und meine app nicht erhalten. In der FB-Konsole sehe ich den status abgeschlossen, aber die Ungefähre Anzahl der Geräte ist "-"
Natürlich habe ich aktualisiert, Bestimmungen profile und APNS cert
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//Register for remote notifications
if #available(iOS 8.0, *) {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
} else {
//Fallback
let types: UIRemoteNotificationType = [.Alert, .Badge, .Sound]
application.registerForRemoteNotificationTypes(types)
}
FIRApp.configure()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.tokenRefreshNotificaiton),
name: kFIRInstanceIDTokenRefreshNotification, object: nil)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
print(userInfo)
}
func tokenRefreshNotificaiton(notification: NSNotification) {
if let refreshedToken = FIRInstanceID.instanceID().token() {
print("InstanceID token: \(refreshedToken)")
User.sharedUser.googleUID = refreshedToken
}
}
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [NSObject : AnyObject], withResponseInfo responseInfo: [NSObject : AnyObject], completionHandler: () -> Void) {
print(userInfo)
}
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Prod)
}
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [NSObject : AnyObject], withResponseInfo responseInfo: [NSObject : AnyObject], completionHandler: () -> Void) {
print(userInfo)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
print(userInfo)
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
print("ошибка")
print(error)
print(error.description)
}
Posten Sie Ihre
Bearbeiten und hinzufügen von code
Frank, was ist der Zweck dieses code
application:didRegisterForRemoteNotificationsWithDeviceToken:
und application:didFailToRegisterForRemoteNotificationsWithError:
code.Bearbeiten und hinzufügen von code
Frank, was ist der Zweck dieses code
FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Prod)
? Es heißt nicht: in der Feuerstellung Beispiel, dass es nötig ist.InformationsquelleAutor alex willrock | 2016-05-25
Du musst angemeldet sein, um einen Kommentar abzugeben.
Das erste, was ich sehe, ist, dass es kein Aufruf zu verbinden
FIRMessaging
. Versuchen Sie, diese zu IhremAppDelegate
:InformationsquelleAutor Mark
Verwenden Sie den folgenden code.
InformationsquelleAutor Kavin Kumar Arumugam