如何在react-native-ios中实现推送通知

时间:2016-10-18 06:40:22

标签: ios push-notification react-native-android

请参阅Push Notificationreact-native-ios实施的任何分步流程。

我找到了这个链接: Push Notification- react-native

但我无法理解实现它的完美方式。

1 个答案:

答案 0 :(得分:0)

// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
 [RCTPushNotificationManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}


 // Required for the notification event.
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
    {
     [RCTPushNotificationManager application:application didReceiveRemoteNotification:notification];
    }
// 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];
}

参考此链接How to Setup Push Notifications with React Native

Setup Push Notifications with React Native tutorial