Skip to content

Commit caaa07e

Browse files
authored
Check if the init is really finished. (#868)
1 parent d018a29 commit caaa07e

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,11 +2124,11 @@ - (void)initUserSessionAndCallCallback:(BOOL)callCallback {
21242124
}
21252125
}
21262126
// If the session is not yet initialized
2127-
if (self.initializationStatus != BNCInitStatusInitialized) {
2127+
if (self.initializationStatus == BNCInitStatusUninitialized) {
21282128
[self initializeSession];
21292129
}
21302130
// If the session was initialized, but callCallback was specified, do so.
2131-
else if (callCallback) {
2131+
else if (callCallback && self.initializationStatus == BNCInitStatusInitialized) {
21322132
if (self.sessionInitWithParamsCallback) {
21332133
self.sessionInitWithParamsCallback([self getLatestReferringParams], nil);
21342134
}

Branch-TestBed/Branch-TestBed/AppDelegate.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ - (BOOL)application:(UIApplication *)application
5757
* Required: Initialize Branch, passing a deep link handler block:
5858
*/
5959

60+
[branch setIdentity:@"Bobby Branch"];
6061
[branch initSessionWithLaunchOptions:launchOptions
6162
andRegisterDeepLinkHandlerUsingBranchUniversalObject:
6263
^ (BranchUniversalObject * _Nullable universalObject, BranchLinkProperties * _Nullable linkProperties, NSError * _Nullable error) {

Examples/UITestBed/UITestBed/TBAppDelegate.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ - (BOOL)application:(UIApplication *)application
4444
// [branch validateSDKIntegration];
4545

4646
// Comment / un-comment to toggle debugging
47-
//[branch setDebug];
47+
[branch setDebug];
4848

4949
// Optionally check for Apple Search Ads attribution:
50-
[branch delayInitToCheckForSearchAds];
50+
//[branch delayInitToCheckForSearchAds];
5151

5252
// Turn this on to debug Apple Search Ads. Should not be included for production.
5353
// [branch setAppleSearchAdsDebugMode];
@@ -58,7 +58,8 @@ - (BOOL)application:(UIApplication *)application
5858
BNCLogSetDisplayLevel(BNCLogLevelAll);
5959
[branch setWhiteListedSchemes:@[@"branchuitest"]];
6060

61-
#if 0
61+
#if 1
62+
// [branch setIdentity:@"Bobby Branch"];
6263
[branch initSessionWithLaunchOptions:launchOptions
6364
andRegisterDeepLinkHandler:^(NSDictionary * _Nullable params, NSError * _Nullable error) {
6465
[self handleBranchDeepLinkParameters:params error:error];
@@ -195,7 +196,7 @@ - (void)handleBranchDeepLinkParameters:(NSDictionary*)params error:(NSError*)err
195196
[[TBDetailViewController alloc] initWithData:params];
196197
dataViewController.title = @"Link Opened";
197198
dataViewController.message = params[@"~referring_link"];
198-
if (!dataViewController.message)
199+
if (!dataViewController.message.length)
199200
dataViewController.message = params[@"+non_branch_link"];
200201
if (dataViewController.message.length == 0)
201202
dataViewController.message = @"< No URL >";

0 commit comments

Comments
 (0)