I am using react-native to run my ios application, and I currently have push notifications successfully working through urban airship. I also have deep linking working, but only in several different situations:
I need the application to launch when clicking on the push notification from urban airship as well as perform the deep link, but right now it will only launch the application and the deep link will only perform if the application is already in the background.
Here is my code in AppDelegate.m that is performing urban airship notifications(only displaying relevant code):
#import "AppDelegate.h"
#import "RCTRootView.h"
#import "RCTLinkingManager.h"
#import <AirshipKit/AirshipKit.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[UAirship takeOff];
[UAirship push].userPushNotificationsEnabled = YES;
return YES;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
In the above code, the openURL argument is only called in the two situations listed above.
Messed around with handling different urban airship situations, but couldn't get them to work. UASituation documentation
When is the action not working for you?
The deep link action has a default predicate that rejects the UASituationForegroundPush
situation. Thats to prevent the application from automatically deep linking if a push is received in the foreground. You can remote the predicate with the following:
[[UAirship shared].actionRegistry updatePredicate:nil
forEntryWithName:kUADeepLinkActionDefaultRegistryName];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.