0
Ich verwende Firebase, um mich für Themen zu registrieren und Push-Benachrichtigungen auf iOS-Geräten zu senden. Alles funktioniert gut außer für iPhone 4 (iOS 7), wo ich keine Benachrichtigungen erhalte.FCM-Themen - Benachrichtigungen nicht auf iPhone 4 (iOS 7) empfangen
Ich kann einzelne Gerätebenachrichtigungen an alle senden, einschließlich iPhone 4 (iOS 7), das Problem ist nur mit Thema Push-Benachrichtigungen. Mein Code unten.
-(void)application:(UIApplication)application didRegisterUserNotificationSettings:(UIUserNotificationSettings)notificationSettings
{
[[FIRMessaging messaging] subscribeToTopic:@"/topics/mytopic"];
[application registerForRemoteNotifications];
}
-(BOOL)application:(UIApplication)application didFinishLaunchingWithOptions:(NSDictionary)launchOptions
{
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// iOS 8 Notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshCallback:) name:kFIRInstanceIDTokenRefreshNotification object:nil];
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
}
else
{
// iOS < 8 Notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshCallback:) name:kFIRInstanceIDTokenRefreshNotification object:nil];
[[FIRMessaging messaging] subscribeToTopic:@"/topics/mytopic"];
[application registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
}
wie für Themen in iOS 7 abonnieren? – Hya
[[FIRMessaging messaging] subscribeToTopic: @ "/ topics/news"]; –
gibt Fehler bei [[NSNotificationCenter defaultCenter] an. AddObserver: self selector: @selector (tokenRefreshNotification :) Name: kFIRInstanceIDTokenRefreshNotification object: nil]; – Hya