mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
4f89fa9cf3
Summary: This is an updated version of #2336 and #7694. --- This adds a `registrationError` event that is emitted by `PushNotificationIOS` whenever an application receives a registration error from APNS (APNS service failure, running on simulator, etc). This event fires to the exclusion of the `register` event (and vice versa). **How to use** Add the following to your `AppDelegate.m`: ```obj-c - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error]; } ``` And register an event handler for the event: ```js PushNotificationIOS.addEventListener('registrationError', function({ message, code }) { // Complete your registration process in error. }); ``` **Test plan** Added support for this event (and `register`) to UIExplorer as a proof of concept. Navigating to the push notifications example on a simulator is an easy way to reproduce this e Closes https://github.com/facebook/react-native/pull/9650 Differential Revision: D3822142 Pulled By: javache fbshipit-source-id: a15ed8941b74dc3eed2c44c658deccbcaf39ce3d
21 lines
793 B
Objective-C
21 lines
793 B
Objective-C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#import "RCTEventEmitter.h"
|
|
|
|
@interface RCTPushNotificationManager : RCTEventEmitter
|
|
|
|
+ (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
|
|
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
|
|
+ (void)didReceiveRemoteNotification:(NSDictionary *)notification;
|
|
+ (void)didReceiveLocalNotification:(UILocalNotification *)notification;
|
|
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
|
|
|
|
@end
|