Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Branch-TestBed/Branch-TestBed/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "ViewController.h"
#import "Branch.h"
#import "BNCEncodingUtils.h"
#import "BranchEvent.h"

AppDelegate* appDelegate = nil;
void APPLogHookFunction(NSDate*_Nonnull timestamp, BranchLogLevel level, NSString*_Nullable message);
Expand All @@ -33,7 +34,6 @@ - (BOOL)application:(UIApplication *)application

// Branch.useTestBranchKey = YES; // Make sure to comment this line out for production apps!!!
Branch *branch = [Branch getInstance];


// Change the Branch base API URL
//[Branch setAPIUrl:@"https://api3.branch.io"];
Expand Down Expand Up @@ -81,6 +81,12 @@ - (BOOL)application:(UIApplication *)application
[self handleDeepLinkObject:universalObject linkProperties:linkProperties error:error];
}];


BranchEvent *earlyEvent = [BranchEvent standardEvent:BNCAddToCartEvent];
NSLog(@"Logging Early Event: %@", earlyEvent);
[earlyEvent logEvent];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to queue an event before the sdk is initialized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah



// Push notification support (Optional)
// [self registerForPushNotifications:application];

Expand Down
8 changes: 6 additions & 2 deletions Sources/BranchSDK/Branch.m
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,9 @@ - (BOOL)isReplayableRequest:(BNCServerRequest *)request {

- (void)processNextQueueItem {
dispatch_semaphore_wait(self.processing_sema, DISPATCH_TIME_FOREVER);


[[BranchLogger shared] logVerbose:[NSString stringWithFormat:@"Processing next queue item. Network Count: %ld. Queue depth: %ld", (long)self.networkCount, (long)self.requestQueue.queueDepth] error:nil];

if (self.networkCount == 0 &&
self.requestQueue.queueDepth > 0) {

Expand All @@ -1920,10 +1922,11 @@ - (void)processNextQueueItem {

if (req) {

// If tracking is disabled, then do not check for install event. It won't exist.
// If tracking is disabled, then do not check for install event. It won't exist.
if (!Branch.trackingDisabled) {
if (![req isKindOfClass:[BranchInstallRequest class]] && !self.preferenceHelper.randomizedBundleToken) {
[[BranchLogger shared] logError:@"User session has not been initialized!" error:nil];
self.networkCount = 0;
BNCPerformBlockOnMainThreadSync(^{
[req processResponse:nil error:[NSError branchErrorWithCode:BNCInitError]];
});
Expand All @@ -1932,6 +1935,7 @@ - (void)processNextQueueItem {
} else if (![req isKindOfClass:[BranchOpenRequest class]] &&
(!self.preferenceHelper.randomizedDeviceToken || !self.preferenceHelper.sessionID)) {
[[BranchLogger shared] logError:@"Missing session items!" error:nil];
self.networkCount = 0;
BNCPerformBlockOnMainThreadSync(^{
[req processResponse:nil error:[NSError branchErrorWithCode:BNCInitError]];
});
Expand Down
Loading