Closed blakedallen closed 6 years ago
Hmm, this works for me with both deferred deep linking and regular deep linking. I'm using Xcode 9.3 / iOS 11.3 / iPhone 7 Plus.
Try change the casting so that it matches the actual parameters that are passed:
print("Params: %@", params as [AnyHashable: AnyObject]? ?? {})
Here's the whole code snippet of my application:didFinishLaunchingWithOptions:
method:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:[UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
AppData.shared.initialize()
let branch: Branch = Branch.getInstance()
branch.initSession(launchOptions: launchOptions, andRegisterDeepLinkHandler: {params, error in
if error == nil {
// params are the deep linked params associated with the link that the
// user clicked -> was re-directed to this app
// params will be empty if no data found
// ... insert custom logic here ...
print("Params: %@", params as [AnyHashable: AnyObject]? ?? {})
}
})
return true
}
@blakedallen Did you resolve your issue?
If you're still crashing you can re-open this issue.
@E-B-Smith Thank you for your response! This was tricky to debug but I looked into this and found out how to reproduce. So in our setup we're using branch to deeplink a user from an email to the app. The flow currently works like so:
User taps email link --> user is sent to our server --> our server requests a branch link --> user is redirected to the branch link --> user opens the app --> app crashes
The issue it turns out, stems from us using a redirect. When I just tap the branch link directly, things work fine. If I redirect the user to a branch link, the app crashes on load.
As a simple solution, we could just include the link as-is in the email, which would require us to request the deeplink from branch and then include that in the email (rather than my system generating these links when the user taps and redirecting the user)
Is this a known issue with the branch SDK? We used this flow about a year ago and it seemed to work fine then, if it's not how to properly use branch links we can adjust, but thought it was worth mentioning the problem here.
I still don't quite understand why you're getting a crash here, but I'm glad you solved it.
Branch has a deep-linked email solution. Here's a link to the docs: https://docs.branch.io/pages/emails/get-started/
This may save you some grief.
Getting a EXC_BAD_ACCESS error in iOS 11.3, Swift 4 when tapping on a deep link. I have created a separate new project to make sure that the branch library wasn't interacting with any other libraries. Followed the steps in the SDK install instructions.
Error occurs when: Tapping a deep link in google inbox --> user is successfully routed to the app --> the app crashes when loading. https://cl.ly/30351I1s0G2j
App Delegate
Important note: When opening the app the branch parameters are there, so we know deferred deep linking is working, however there seems to be a crash on load with deep linking.
Would love to know if there is something I'm missing here. Thanks in advance!