Skip to content

Commit 0c0c563

Browse files
Merge pull request #460 from BranchMetrics/supporting-swift
launchOptions dictionary contains null values if passed from Swift
2 parents 584bd42 + 6e4b197 commit 0c0c563

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Branch-SDK/Branch-SDK/Branch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
448448
but that UL is not a Facebook UL. Some developers prefer not to modify
449449
`application:didFinishLaunchingWithOptions:` to always return `YES` and should use this method instead.
450450
*/
451-
- (void)accountForFacebookSDKPreventingAppLaunch;
451+
- (void)accountForFacebookSDKPreventingAppLaunch __attribute__((deprecated(("Please ensure application:didFinishLaunchingWithOptions: always returns YES/true instead of using this method. It will be removed in a future release."))));
452452

453453
- (void)suppressWarningLogs;
454454

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,15 @@ - (void)initSessionWithLaunchOptions:(NSDictionary *)options isReferrable:(BOOL)
339339
}
340340

341341
if ([BNCSystemObserver getOSVersion].integerValue >= 8) {
342-
if (![options objectForKey:UIApplicationLaunchOptionsURLKey] && ![options objectForKey:UIApplicationLaunchOptionsUserActivityDictionaryKey]) {
342+
if (![options.allKeys containsObject:UIApplicationLaunchOptionsURLKey] && ![options.allKeys containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) {
343343
// If Facebook SDK is present, call deferred app link check here
344344
if (![self checkFacebookAppLinks]) {
345345
[self initUserSessionAndCallCallback:YES];
346346
}
347347
}
348-
else if ([options objectForKey:UIApplicationLaunchOptionsUserActivityDictionaryKey]) {
348+
else if ([options.allKeys containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) {
349349
if (self.accountForFacebookSDK) {
350+
// does not work in Swift, because Objective-C to Swift interop is bad
350351
id activity = [[options objectForKey:UIApplicationLaunchOptionsUserActivityDictionaryKey] objectForKey:@"UIApplicationLaunchOptionsUserActivityKey"];
351352
if (activity && [activity isKindOfClass:[NSUserActivity class]]) {
352353
[self continueUserActivity:activity];
@@ -356,7 +357,7 @@ - (void)initSessionWithLaunchOptions:(NSDictionary *)options isReferrable:(BOOL)
356357
self.preferenceHelper.shouldWaitForInit = YES;
357358
}
358359
}
359-
else if (![options objectForKey:UIApplicationLaunchOptionsURLKey]) {
360+
else if (![options.allKeys containsObject:UIApplicationLaunchOptionsURLKey]) {
360361
[self initUserSessionAndCallCallback:YES];
361362
}
362363
}

0 commit comments

Comments
 (0)