我实现了branch.io链接,它对于WhatsApp和Notes都可以正常运行,但不能与Facebook Messenger或其他任何带有应用内浏览器的地方配合使用。
要解决此限制,您的链接必须具有深度视图或类似的功能,并且号召性用语链接/按钮后面带有通用链接。这样,单击应用程序供稿中的链接将打开一个包含您的深度视图页面的Web视图,然后用户可以单击链接/按钮以启动您的应用程序。
例如,Facebook Messenger应该打开带有我的链接深层视图的应用内浏览器,如果用户点击按钮-应该打开我的应用,对我来说很好,但不能这样工作。
在我的情况下,facebook正在使用我的Deepview打开应用程序内浏览器,并自动(我没有点击按钮)将我重定向到... AppStore :(。但是,如果我手动打开我的应用程序,则会收到回调并应用程序将我重定向到正确的位置。
答案 0 :(得分:2)
我遇到了同样的问题。从 Branch.io SDK 返回的分支对象返回一个没有所有参数的对象。 我所做的只是遵循 Branch.io 提供的优秀文档 document provided by Branch.io
所以当我在我的应用程序中使用场景时。在我的 sceneDelegate 中调用这些方法解决了这个问题。
import UIKit
import Branch
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
// workaround for SceneDelegate continueUserActivity not getting called on cold start
if let userActivity = connectionOptions.userActivities.first {
BranchScene.shared().scene(scene, continue: userActivity)
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
BranchScene.shared().scene(scene, continue: userActivity)
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
BranchScene.shared().scene(scene, openURLContexts: URLContexts)
}
}
答案 1 :(得分:0)
由于通用链接有条件地工作,因此建议对在Facebook上共享的链接使用强制重定向。您可以通过将 $ uri_redirect_mode = 2 作为查询参数附加到“分支”链接来强制Facebook打开应用。
例如:https://example.app.link/83jlowd0?$ uri_redirect_mode = 2
您可以在此处了解有关强制重定向的更多信息-https://docs.branch.io/pages/links/integrate/#forced-redirections
如果仍然遇到问题,请写信至support@branch.io,分支团队的某人将能够为您提供帮助。