1
我一直在Xcode 8中使用Branch SDK,swift,iOS9.3。Branch.io:添加的元數據參數無法獲取路由:IOS Deep Link
在創建鏈接,通過空投,添加的參數是沒有得到在「的PARAMS變量:
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)")
}
}
}
})
如何在應用程序打開時獲取添加的metaDataKey作爲參數DeepLink,如:params [「product_picture」]
感謝您的回覆。是的,我通過郵件嘗試過。就此而言,當我點擊郵件中的鏈接時。該應用程序打開,但重定向不哈哈(沒有得到參數)。但是,當應用程序通過app.link打開,顯示iOS的深層視圖以及在頂部打開應用程序的選項時,通過該鏈接打開應用程序時,我正在獲取參數併發生重定向。 我正在檢查AppDelegate類的didFinishLaunchingWithOptions方法中的參數。 –
在儀表板的「實時查看」部分的「事件」類別中,當應用程序打開時單擊共享鏈接,「會話引用鏈接url」獲取對應記錄的零。 –
嗯...'didFinishLaunchingWithOptions'是正確的地方要檢查這一點。您是否可以記錄單擊郵件鏈接時發生的情況的屏幕截圖? –