简体   繁体   中英

how to use Urban Airship Deep link in ios

如何在ios中处理Urban airship深度链接,如何在通知中接收配置的深度链接,一旦通知接收到我应使用哪种方法来处理该Deeplink,我就可以通过Urban airship发送该Deeplink。

You have two solutions.

Solution 1: Use custom-url schemes

Add a custom url scheme to your application. Then make all deep links from a Urban Airship push message contain this custom url scheme.

Urban Airship automatically calls open application on this deep link and thereby enacting the deep link on your app.

Solution 2: Use UAPushNotificationDelegate

Add your class as a push notification delegate of UAPush singleton.

- (void)initializePushMessageService {

    [UAirship takeOff];
    [UAPush shared].pushNotificationDelegate = self;
}

#pragma mark - UAPushNotificationDelegate

- (void)launchedFromNotification:(NSDictionary *)notification
          fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {

    if([self hasDeeplink:notification]) {

        NSString *deeplink = [self deepLinkPathFromNotification:notification];

        //do something with the deeplink
    }
}

#define kUrbanAirshipDeepLinkKey    @"^d"
- (BOOL)hasDeeplink:(NSDictionary *)notification {
    return notification[kUrbanAirshipDeepLinkKey] != nil;
}

- (NSString *)deepLinkPathFromNotification:(NSDictionary *)notification {
    return notification[kUrbanAirshipDeepLinkKey];
}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM