我一直在Xcode8,swift,iOS9.3中使用Branch SDK。
创建链接并通过Airdrop时,添加的参数未进入"params variable of:
branch.initSession(launchOptions: launchOptions, isReferrable: true, andRegisterDeepLinkHandler: {(params : [AnyHashable : Any]?, error) -> Void in
当打印"params“其打印时:
▿ Optional<Dictionary<AnyHashable, Any>>
▿ some : 2 elements
▿ 0 : 2 elements
▿ .0 : AnyHashable("+clicked_branch_link")
- value : "+clicked_branch_link"
- .1 : 0
▿ 1 : 2 elements
▿ .0 : AnyHashable("+is_first_session")
- value : "+is_first_session"
- .1 : 0
我创建的链接:
branchUniversalObject = BranchUniversalObject(canonicalIdentifier: "item/1")
branchUniversalObject.title = "Meet Mr. Squiggles"
branchUniversalObject.contentDescription = "Your friend Josh has invited you to meet his awesome monster, Mr. Squiggles!"
branchUniversalObject.imageUrl = "https://example.com/monster-pic-12345.png"
branchUniversalObject.addMetadataKey("userId", value: "12345")
branchUniversalObject.addMetadataKey("userName", value: "Josh")
branchUniversalObject.addMetadataKey("monsterName", value: "Mr. Squiggles")
branchUniversalObject.addMetadataKey("product_picture", value: "Mr. Squiggles product_picture")
branchUniversalObject.automaticallyListOnSpotlight = true
branchUniversalObject.userCompletedAction(BNCRegisterViewEvent)
linkProperties = BranchLinkProperties()
linkProperties.feature = "share"
linkProperties.addControlParam("$desktop_url", withValue: "http://example.com/home")
linkProperties.addControlParam("$ios_url", withValue: "http://example.com/ios")
branchUniversalObject.getShortUrl(with: linkProperties, andCallback: { (optUrl: String?, error: Error?) in
if error == nil, let url = optUrl {
print("got my Branch link to share: %@", url)
DispatchQueue.main.async {
self.branchUniversalObject.showShareSheet(with: self.linkProperties,
andShareText: "Super amazing thing I want to share!",
from: self) { (activity: String?, success: Bool) in
print("done showing share sheet! : \(success)")
}
}
}
})
app通过DeepLink打开时,如何将添加的metaDataKey作为参数拉取,如: params"product_picture“
发布于 2016-10-08 01:29:15
Alex from Branch here:+clicked_branch_link: 0
参数表示SDK没有检测到该设备的任何链接。这就是为什么你不能取回你的元数据。
是否只有在通过AirDrop共享链接时才会发生这种情况?您是否可以尝试通过Notes或Messages打开一个链接,并查看您的元数据是否按预期返回?
https://stackoverflow.com/questions/39912061
复制相似问题