Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHNL-10057 Note react native firebase sdk capitalization issue #177

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,26 @@ there are two possible reasons for this:

### Deep links in push notifications not getting sent over to React Native layer when the iOS app is terminated

When the iOS app is terminated (killed from the app switcher by swiping up), there is a bug in React Native that
prevents the native layer from calling the listeners set up in React Native to listen to incoming deep links.
The listener in question here is `Linking.getInitialURL()` which is expected to be called when a deep link is
When the iOS app is terminated (killed from the app switcher by swiping up), there is a bug in React Native that
prevents the native layer from calling the listeners set up in React Native to listen to incoming deep links.
The listener in question here is `Linking.getInitialURL()` which is expected to be called when a deep link is
available while the app is terminated.

You can find the open issue describing this problem on React Native's GitHub repository [Here](https://github.com/facebook/react-native/issues/32350).
There are many workarounds suggested in this issue's thread and a few other similar issues.
However, the workaround that worked for us involves intercepting the launch arguments in the app delegate and adding
You can find the open issue describing this problem on React Native's GitHub repository [Here](https://github.com/facebook/react-native/issues/32350).
There are many workarounds suggested in this issue's thread and a few other similar issues.
However, the workaround that worked for us involves intercepting the launch arguments in the app delegate and adding
a key `UIApplicationLaunchOptionsURLKey`, which React Native expects to be present when calling the `Linking.getInitialURL()` listener.


Here's a method to implement this workaround:


```swift
```swift
- (NSMutableDictionary *)getLaunchOptionsWithURL:(NSDictionary * _Nullable)launchOptions {
NSMutableDictionary *launchOptionsWithURL = [NSMutableDictionary dictionaryWithDictionary:launchOptions];
if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
NSDictionary *remoteNotification = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];

if (remoteNotification[@"url"]) {
NSString *initialURL = remoteNotification[@"url"];
if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {
Expand All @@ -85,7 +85,7 @@ Here's a method to implement this workaround:
}
```

Ensure that this method is called from `application:didFinishLaunchingWithOptions:` before calling the superclass method with the
Ensure that this method is called from `application:didFinishLaunchingWithOptions:` before calling the superclass method with the
modified launch arguments, like so:


Expand All @@ -96,14 +96,19 @@ modified launch arguments, like so:
self.initialProps = @{};

// some more code ...

NSMutableDictionary * launchOptionsWithURL = [self getLaunchOptionsWithURL:launchOptions];

return [super application:application didFinishLaunchingWithOptions:launchOptionsWithURL];
}

```

This implementation is included in the example app in this repo and can be used for testing.
This implementation is included in the example app in this repo and can be used for testing.
Make sure to use the URL scheme (rntest://) of the example app when testing.

### iOS APNS Token Troubleshooting
There is an open issue with [`@react-native-firebase/messaging`](https://github.com/invertase/react-native-firebase/issues/8022) where the SDK will uppercase any APNS token returned using `messaging().getAPNSToken()`.
You can verify this by adding a log the `AppDelegate.m` file that prints the deviceToken (you will need to convert to a hex string).
This might have no impact on your use case, but is something to consider when designing.

Loading