BranchMetrics / cordova-ionic-phonegap-branch-deep-linking-attribution

The Branch Cordova Ionic Phonegap SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/cordova-phonegap-ionic/
MIT License
234 stars 144 forks source link

bug: iOS crashes with registerView and generateShortUrl #717

Closed malua closed 1 year ago

malua commented 1 year ago

Describe the bug

Hey! I am seeing crashes on iOS from registerView and generateShortUrl. xcode marks the following lines as the origin of the exception. image image

https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/blob/82b031bf90e554ff1389fb41d810f762008b385d/src/ios/BranchSDK.m#L412

https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/blob/82b031bf90e554ff1389fb41d810f762008b385d/src/ios/BranchSDK.m#L433

I am always creating a BranchUniversalObject before accessing registerView or generateShortUrl. They are only called in if the promise of the BUO correctly resolves.

Do you maybe have any insight on why this could be happening?

Steps to reproduce

I don't really know how to reproduce it.

Expected behavior

The BUO should be available at this point.

SDK Version

5.2.0

Make and Model

iPhones

OS

iOS >= 15

Additional Information/Context

No response

malua commented 1 year ago

I found iOS crash reports in Rollbar in which a Thread crashes. This thread has something to do with the LinkPresenation framework used by Branch. As this is the only plugin that uses LinkPresentation, I suspect it's Branch. And the reports are connected.

https://developer.apple.com/forums/thread/725705

malua commented 1 year ago

Screenshot 2023-06-07 at 09 35 35

malua commented 1 year ago

The issue was, that the called Branch.logout() which clears the Branch Universal Objects in the native part - and then tried to call a method on a BUO, which lead to this error.