Skip to content

Commit

Permalink
Update to support iOS 15 NativeLink™ feature (#41)
Browse files Browse the repository at this point in the history
Full information in the Branch iOS SDK documentation here: https://help.branch.io/developers-hub/docs/ios-advanced-features#nativelink-deferred-deep-linking

Note: Requires Branch iOS SDK version 1.39.4 or higher, but I've implemented the method call in our kit wrapper to fail gracefully if using an older version of their SDK or if the new `checkPasteboardOnInstall` method is removed in the future for any reason.
  • Loading branch information
einsteinx2 authored Aug 24, 2021
1 parent 08b05c2 commit bcb4cbd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
.upToNextMajor(from: "8.2.0")),
.package(name: "Branch",
url: "https://github.com/BranchMetrics/ios-branch-sdk-spm",
.upToNextMajor(from: "1.39.1")),
.upToNextMajor(from: "1.39.4")),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion mParticle-BranchMetrics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "9.0"
s.ios.source_files = 'mParticle-BranchMetrics/*.{h,m,mm}'
s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.2'
s.ios.dependency 'Branch', '~> 1.39.1'
s.ios.dependency 'Branch', '~> 1.39.4'
end
10 changes: 10 additions & 0 deletions mParticle-BranchMetrics/MPKitBranchMetrics.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ - (void)start {
[self.branchInstance registerPluginName:@"mParticle - iOS" version:MPKitBranchMetricsVersionNumber];

if (self.enableAppleSearchAds) [self.branchInstance delayInitToCheckForSearchAds];

// iOS 15 Branch NativeLink™ support
// https://help.branch.io/developers-hub/docs/ios-advanced-features#nativelink-deferred-deep-linking
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
if ([Branch respondsToSelector:@selector(checkPasteboardOnInstall)]) {
[Branch performSelector:@selector(checkPasteboardOnInstall)];
}
#pragma clang diagnostic pop

[self.branchInstance initSessionWithLaunchOptions:self.launchOptions
isReferrable:YES
andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
Expand Down

0 comments on commit bcb4cbd

Please sign in to comment.