你好,我正在尝试在我的应用程序中执行深度链接功能,但是当我点击通知并打开应用程序时,回调不会被调用。 我正在学习本教程: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 的 header :
- (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。当应用程序在后台时,我收到通知,我点击它,应用程序打开但没有调用回调。
我不知道我做错了什么。 感谢阅读。
最佳答案
正如 dperconti 在评论中所建议的那样:
为应用程序启用远程通知为我解决了这个问题:
http://docs.urbanairship.com/build/ios_features.html#background-push
关于ios - CustomPushHandler 代表不被称为深度链接 Urban Airship ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20287984/