Universal Link校验不通过/接入新SDK,跳到微信后再回跳App,流程就中止?
Q:Universal Link校验不通过,无法调起微信支付? A:请开发者在调用register接口前,打开WXApi.h的日志接口,观察报错日志和原因: + (voidstartLogByLevel:(WXLogLevel)levellogBlock:(WXLogBolock)logBlock Q:接入新SDK,跳到微信后再回跳App,流程就中止? A:1. 首先,微信唤起App,App一定会收到系统回调。请确认系统回调是Scheme回调还是Universal Links回调。 2. 如果是Scheme回调,请检查是否走了UISceneDelegate(XCode11构建的项目),或是UIApplicationDelegate。它们的回调方法分别是 - (void)scene:(UIScene *)scene openURLContexts:(NSSetUIOpenURLContext *> *)URLContexts;
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionaryUIApplicationOpenURLOptionsKey, id> *)options;
3. 如果是Universal Links回调,同样也检查是否走了UISceneDelegate(XCode11构建的项目),或是UIApplicationDelegate。它们的回调方法分别是 - (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArrayidUIUserActivityRest
oring>> * __nullable restorableObjects))restorationHandler
4. 因为考虑兼容旧版本微信,因此无论Scheme或Universal Links回调都必须处理。 在重写回调方法后,需要分别调用WXApi的handleOpenUrl和handleOpenUniversalLink方法 示例: - (voidscene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity {
return [WXApi handleOpenUniversalLink:userActivity delegate:self
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:void(^)(NSArrayidUIUserActivityRest
oring>> * __nullable restorableObjects))restorationHandler {
return [WXApi handleOpenUniversalLink:userActivity delegate:self];
https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/iOS.html