0

TL;DR
Error was a space in the url not being encoded. Will be fixed by the Branch Guys on their side


I integrated iOS SDK and did all the setup for Universal Links as explained in the guides. I've got everything properly configured (or so it seems), and opening a link takes me to the application. However this issue doesn't seem to be related to the deeplinking functionality.

Steps:

1.- Open the app
2.- Go back to the homescreen (don't close the app)
3.- Open the app again
4.- CRASH

The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported

The line crashing is (BNCStrongMatchHelper.m:114):
UIViewController * safController = [[SFSafariViewControllerClass alloc] initWithURL:[NSURL URLWithString:urlString]];

But at this point urlString is an https link.

Further info:

    Fatal Exception: NSInvalidArgumentException
    0 CoreFoundation 0x1819bae38 __exceptionPreprocess
    1 libobjc.A.dylib 0x18101ff80 objc_exception_throw
    2 CoreFoundation 0x1819bad80 -[NSException initWithCoder:]
    3 SafariServices 0x18dd9e3fc -[SFSafariViewController initWithURL:entersReaderIfAvailable:]
    4 [myapp] 0x1002acc00 -[BNCStrongMatchHelper presentSafariVCWithBranchKey:] (BNCStrongMatchHelper.m:114)
    5 [myapp] 0x1002ac590 -[BNCStrongMatchHelper createStrongMatchWithBranchKey:] (BNCStrongMatchHelper.m:66)
    6 [myapp] 0x1002bdef0 -[Branch registerInstallOrOpen:] (Branch.m:1369)
    7 [myapp] 0x1002bdd74 -[Branch initializeSession] (Branch.m:1354)
    8 [myapp] 0x1002bd914 -[Branch initUserSessionAndCallCallback:] (Branch.m:1328)
    9 [myapp] 0x1002bc104 -[Branch applicationDidBecomeActive] (Branch.m:1203)
    10 CoreFoundation 0x18195ceac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
    11 CoreFoundation 0x18195c6cc _CFXRegistrationPost
    12 CoreFoundation 0x18195c44c ___CFXNotificationPost_block_invoke
    13 CoreFoundation 0x1819c5494 -[_CFXNotificationRegistrar find:object:observer:enumerator:]
    14 CoreFoundation 0x18189a788 _CFXNotificationPost
    15 Foundation 0x1822a289c -[NSNotificationCenter postNotificationName:object:userInfo:]
    16 UIKit 0x186b8e014 -[UIApplication _stopDeactivatingForReason:]
    17 UIKit 0x186dacdc4 __62-[UIApplication _sceneSettingsPostLifecycleEventDiffInspector]_block_invoke1180
    18 FrontBoardServices 0x18334c7b4 __52-[FBSSettingsDiffInspector inspectDiff:withContext:]_block_invoke27
    19 Foundation 0x1823517e8 __NSIndexSetEnumerate
    20 BaseBoard 0x1832d4728 -[BSSettingsDiff inspectChangesWithBlock:]
    21 FrontBoardServices 0x183347d94 -[FBSSettingsDiff inspectOtherChangesWithBlock:]
    22 FrontBoardServices 0x18334c58c -[FBSSettingsDiffInspector inspectDiff:withContext:]
    23 UIKit 0x186dad648 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
    24 UIKit 0x186dad2a4 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]
    25 FrontBoardServices 0x18335b7ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
    26 FrontBoardServices 0x18335b618 -[FBSSerialQueue _performNext]
    27 FrontBoardServices 0x18335b9c8 -[FBSSerialQueue _performNextFromRunLoopSource]
    28 CoreFoundation 0x181971124 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
    29 CoreFoundation 0x181970bb8 __CFRunLoopDoSources0
    30 CoreFoundation 0x18196e8b8 __CFRunLoopRun
    31 CoreFoundation 0x181898d10 CFRunLoopRunSpecific
    32 GraphicsServices 0x183180088 GSEventRunModal
    33 UIKit 0x186b6df70 UIApplicationMain
    34 [myapp] 0x1001b6984 main (main.m:16)
    35 libdispatch.dylib 0x1814368b8 (Missing)
Cœur
  • 37,241
  • 25
  • 195
  • 267
Andres C
  • 463
  • 6
  • 26

2 Answers2

1

Alex from Branch.io with an update: after some debugging, we determined this was due to a space in urlString (passed through from the app version number). Removing this space resolved the crash.

A more permanent solution from Branch's end is also in the works.

Alex Bauer
  • 13,147
  • 1
  • 27
  • 44
0

Try adding this to your Info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
Vishal
  • 887
  • 9
  • 22