ios - CustomPushHandler 代表不被称为深度链接 Urban Airship

标签 ios objective-c urbanairship.com deep-linking

你好,我正在尝试在我的应用程序中执行深度链接功能,但是当我点击通知并打开应用程序时,回调不会被调用。 我正在学习本教程: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/

相关文章:

ios - iOS7 上错误的 UITableView 分隔符颜色

iphone - 应用程序更新仍然指向旧的已删除 Nib 。如何在不重新安装应用程序的情况下解决此问题?

ios - 无法在 iOS 中使用 slider 显示乘法表

objective-c - 单元测试 (XCTest) NIB 导出为零

iOS 7 - 在自定义 tableViewCell 中更改 textField 的键盘类型

android - Urban Airship Android GCM 未在 Android Oreo 和 Pie 上接收推送通知

ios - 同时关闭两个当前的 ModalViewController(MPMediaPickerController 和 UIViewController)

objective-c - 如何测试对象以查看它是否仍然可以接收消息以避免 EXC_BAD_ACCESS?

swift - UrbanAirship Cocoapods 无法与 use_frameworks 一起使用