Skip to content

Conversation

@nevir
Copy link
Contributor

@nevir nevir commented Aug 29, 2016

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:

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
  [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
}

And register an event handler for the event:

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 event.

@ghost
Copy link

ghost commented Aug 29, 2016

By analyzing the blame information on this pull request, we identified @nicklockwood and @JAStanton to be potential reviewers.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Aug 29, 2016
@ghost
Copy link

ghost commented Aug 29, 2016

@nevir updated the pull request - view changes

@ghost
Copy link

ghost commented Aug 29, 2016

@nevir updated the pull request - view changes

@ghost
Copy link

ghost commented Aug 29, 2016

@nevir updated the pull request - view changes

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 29, 2016
@facebook-github-bot
Copy link
Contributor

@nevir updated the pull request - view changes

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 29, 2016
# pragma mark - Push Notifications

// Required to register for notifications
- (void)application:(UIApplication *)__unused application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format like application:(__unused UIApplication *)application didRegister...

@javache
Copy link
Member

javache commented Sep 6, 2016

Looks good, just a couple of small nits

@nevir
Copy link
Contributor Author

nevir commented Sep 6, 2016

@javache updated (and rebased); thanks for the review!

@ghost
Copy link

ghost commented Sep 6, 2016

@nevir updated the pull request - view changes

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 6, 2016
@javache
Copy link
Member

javache commented Sep 6, 2016

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Sep 6, 2016
@ghost
Copy link

ghost commented Sep 6, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review internal test results.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 6, 2016
rozele pushed a commit to microsoft/react-native-windows that referenced this pull request Sep 14, 2016
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 facebook/react-native#9650

Differential Revision: D3822142

Pulled By: javache

fbshipit-source-id: a15ed8941b74dc3eed2c44c658deccbcaf39ce3d
mikelambert pushed a commit to mikelambert/react-native that referenced this pull request Sep 29, 2016
Summary:
This is an updated version of facebook#2336 and facebook#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 facebook#9650

Differential Revision: D3822142

Pulled By: javache

fbshipit-source-id: a15ed8941b74dc3eed2c44c658deccbcaf39ce3d
@nevir nevir deleted the pn-registration-error-event branch October 4, 2016 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants