Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test Branch.io in simulator?

I'm scratching my head how I'm supposed to test my branch.io integration on simulator.

For link generation, I'm using the Javascript/web SDK instead of the iOS SDK. When you click a button to 'view content in app' on my landing page, it will generate the link and follow it.

All this works just great, but when I open the jump page in the simulator, it never actually attempts to open the local app on the phone which has the same bundle identifier.

I would guess this might be because the current app store URL box is blank (because it doesn't exist yet)... but I am not sure how I'm supposed to test if it works if I can't get the deeplink to trigger it locally.

Thanks!

like image 373
Tallboy Avatar asked Feb 08 '16 02:02

Tallboy


1 Answers

Not exactly ideal, but if you're just trying to pass in static params to your app through a Branch link and test your app's implementation of them in the simulator, you can just hardcode them in the Branch initSessionWithLaunchOptions:andRegisterDeepLinkHandler: block. This block is called every time the application becomes active again (i.e., if it's backgrounded) and on application start, even if it's used in application:didFinishLaunchingWithOptions:.

The Branch handler block passes in a params dictionary, which you can either override (they'll be nil or just contain a few keys, if the block wasn't called from a tapped link) or just create your own to pass into your app.

This obviously doesn't work for testing desktop web site redirects or App Store downloads (or for many other use cases for Branch), but if you just wanted to test redirecting into specific views for your app from a clicked link (or in my case, how a dynamically generated view would look on a 4S when I didn't have a 4S available to test on), it gets the job done.

like image 62
Evan R Avatar answered Oct 04 '22 20:10

Evan R