[英]React native and onesignal notification problem
Hi firstly I learning react-native and I use onesignal for notification everything awesome but sometimes iphone 6s hasnt token one signal error is 'Apns Delegate Never Fired' but 6 plus alwasy has a token and background notification very nice.嗨,首先我学习 react-native,我使用 onesignal 来通知一切都很棒,但有时 iphone 6s 没有标记一个信号错误是“Apns Delegate Never Fired”,但 6 plus 总是有一个非常好的标记和背景通知。 If the application is open while sending a notification, the notification does not occur above.如果在发送通知时应用程序处于打开状态,则上述通知不会发生。 It occurs on a dialog screen.它发生在对话屏幕上。
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "AppDelegate.h" #import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"doyurunbenicomproje" 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]; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } @end
EDIT add this code to your AppDelegate.m
编辑将此代码添加到您的AppDelegate.m
(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"didFailToRegisterForRemoteNotificationsWithError %@", error);
}
kOSSettingsKeyInFocusDisplayOption=2 我添加了此代码,通知将显示为正常通知。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.