您好我试图在我的应用程序中执行深度链接功能,但是当我点击通知并且应用程序打开时,回调没有被调用。 我遵循本教程:https://support.urbanairship.com/customer/portal/articles/1087599-custom-push-handling-in-ios---deep-linking-from-a-push-notification-to-a-url。
以下是appDelegate:
的样子customPushHandler = [[CustomPushHandler alloc] init];
[UAPush shared].pushNotificationDelegate = customPushHandler;
UAConfig *config = [UAConfig defaultConfig];
[UAirship takeOff:config];
[UAPush shared].notificationTypes = (UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert
);
[UAPush setDefaultPushEnabledValue:NO];
[[UAPush shared] setPushEnabled:YES];
[[UAPush shared] resetBadge];
这些是CustomPushHandler的标题:
- (void)displayNotificationAlert:(NSString *)alertMessage;
- (void)receivedBackgroundNotification:(NSDictionary *)notification fetchCompletionHandler:(void ( ^ ) ( UIBackgroundFetchResult result ))completionHandler;
- (void)launchedFromNotification:(NSDictionary *)notification fetchCompletionHandler:(void ( ^ ) ( UIBackgroundFetchResult result ))completionHandler;
- (void)receivedForegroundNotification:(NSDictionary *)notification fetchCompletionHandler:(void ( ^ ) ( UIBackgroundFetchResult result ))completionHandler;
调用的唯一回调是在应用程序运行时调用的displayNotificationAlert。当应用程序在后台我收到通知时,我点击它,应用程序打开但没有回拨。
我不知道我做错了什么。 谢谢你的阅读。
答案 0 :(得分:0)
正如dperconti在评论中所建议的那样:
启用应用程序的远程通知,为我修复此问题:
http://docs.urbanairship.com/build/ios_features.html#background-push