Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
165 stars 142 forks source link

partial apply forwarder for reabstraction thunk helper from @escaping @callee_unowned @convention(block) () -> () #216

Closed Chandanjee closed 4 years ago

Chandanjee commented 4 years ago

Report

completionHandler () -> () 0x0000000104dfe29c BrazeDemo`partial apply forwarder for reabstraction thunk helper from @escaping @callee_unowned @convention(block) () -> () to @escaping @callee_guaranteed () -> () at

Describe your environment.

I am getting above issue in completionHandler. Info Value
Platform Name e.g. ios
Platform Version e.g. 12.1
SDK Version latest
Integration Method cocoapods
Xcode Version e.g. Xcode 11.2
Repro rate e.g. all the time (100%) / sometimes x% / only once

What did you do?

What did you expect to happen?

What happened instead?

Steps to reproduce

Code Snippet

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {

        if response.notification.request.identifier == "Local Notification" {
            print("Handling notifications with the Local Notification Identifier")
        }
        DispatchQueue.main.asyncAfter(deadline: .now() + 2){
        Appboy.sharedInstance()!.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
        }

    }

Are you doing any feature customizations that may relate to the issue? Can you share the code snippet?

Project that demonstrates the issue

Bucimis commented 4 years ago

@Chandanjee can you provide steps to reproduction for the issue you're seeing, as well as more context around the error message?

Chandanjee commented 4 years ago
  1. I created BrazeDemo for push notification. I added code in my project like your developer guide and HelloSwift. I got notification , When I tapped on notification message then this method is called ------ func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {} .
  2. In this function I have add below code - DispatchQueue.main.asyncAfter(deadline: .now() + 2){ Appboy.sharedInstance()!.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler) }.
  3. CompletionHandler show the error - "partial apply forwarder for reabstraction thunk helper from @escaping @callee_unowned @convention(block) () -> ()" and also not called didReciveRemoteNotification method for get any key - value pair in my code.
  4. I am confused to how to get key-value pair from userInfo of didReciveRemoteNotification method.
Bucimis commented 4 years ago

@Chandanjee 2) Any particular reason for wrapping your call to the Braze delegate in an asyncAfter block? You should call the Braze delegate synchronously within your didReceive implementation. 4) You can access userInfo in the UNNotificationResponse object passed into the UserNotificationCenter delegate. e.g.:

let userInfo = response.notification.request.content.userInfo

See https://developer.apple.com/documentation/usernotifications/handling_notifications_and_notification-related_actions?language=objc

Chandanjee commented 4 years ago

Thanks. @Bucimis I have got info from below code. let userInfo = response.notification.request.content.userInfo AND

func handleAppboyURL(_ url: URL, from channel: ABKChannel, withExtras extras: [AnyHashable : Any]) -> Bool { let tag = extras["tag"] as? String let category_id = extras["categoryid"] as? String let category_url = extras["categoryurl"] as? String let v_id = extras["id"] as? String if tag == "video"{

    }
    if (url.host == "deeplink") {
        NSLog("Received link with host.")
        return true;
    }
    // Let Braze handle links otherwise
    return false;
}