这方面的文档不清楚。
https://facebook.github.io/react-native/docs/pushnotificationios.html
And then in your AppDelegate implementation add the following:
是指把这个代码放在
@implementation AppDelegate
下面吗?像这样:#import "RCTPushNotificationManager.h"
#import "AppDelegate.h"
#import "RCTRootView.h"
@implementation AppDelegate
// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings]; } // Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Required for the notification event.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification { [RCTPushNotificationManager didReceiveRemoteNotification:notification]; } // Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { [RCTPushNotificationManager didReceiveLocalNotification:notification]; } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { NSLog(@"%@", error); }
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
...
}
@end
谢谢!
最佳答案
是的,它应该在 AppDelegate 中的 @implementation 内。
这是我在使用 PushNotificationIOS 的应用程序中的 AppDelegate.m
My AppDeligate.m
关于react-native - 什么是 AppDelegate 实现?推送通知IOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38375581/