Токен устройства APNS не установлен перед получением токена FCM для идентификатора отправителя – React Native FirebaseIOS

Программируем под IOS
Ответить Пред. темаСлед. тема
Anonymous
 Токен устройства APNS не установлен перед получением токена FCM для идентификатора отправителя – React Native Firebase

Сообщение Anonymous »

Я следовал этому руководству, чтобы настроить удаленные push-уведомления в моем приложении React-native с использованием React-native-firebase версии 5.2.0. После того, как я все настроил и запустил приложение, я получаю сообщение об ошибке:


Токен устройства APNS не установлен перед получением токена FCM для отправителя ИДЕНТИФИКАТОР ''. Уведомления для этого токена FCM не будут доставляться через APNS. Обязательно повторно получите токен FCM после установки токена APNS.


Пытаюсь выяснить, как это сделать. решить эту проблему, но не удалось.
Работа на React-native: 0.61.2, React-native-firebase: 5.2.0

Ниже мой AppDelegate.m

Код: Выделить всё

#import "AppDelegate.h"

#import 
#import 
#import 
#import 
#import 
#import 

@import Firebase;
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"helloworld"
initialProperties:nil];

rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];

// define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;

return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event.  You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RNCPushNotificationIOS didReceiveLocalNotification:notification];
}

//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
NSLog(@"User Info : %@",notification.request.content.userInfo);
completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
}

@end
и получение токенов в моем App.js:

Код: Выделить всё

const messaging = firebase.messaging();

messaging.hasPermission()
.then((enabled) => {
if (enabled) {
messaging.getToken()
.then(token => { console.log("+++++ TOKEN ++++++" + token) })
.catch(error => { console.log(" +++++ ERROR GT +++++ " + error) })
} else {
messaging.requestPermission()
.then(() => { console.log("+++ PERMISSION REQUESTED +++++") })
.catch(error => { console.log(" +++++ ERROR RP ++++ " + error) })
}

})
.catch(error => { console.log(" +++++ ERROR +++++ " + error) });

Будем очень благодарны за любую помощь! Спасибо!

Подробнее здесь: https://stackoverflow.com/questions/582 ... react-nati
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «IOS»