Introduction to the
With the update of iOS and wechat SDK version, there are changes.
New version, you need to configure Unuversal Links. No way. Let’s start filling the pit.
Introduce Unuversal Links
Seamlessly link to content inside your app, or on your website in iOS 9 or later. With universal links, you can always give users the most integrated mobile experience, Even when your app isn’t installed on their device. Universal Link You can use the same url to open the url and APP.
It looks like a normal HTTPS link, which is configured in the root directory of the link domain. You can also place the corresponding H5 page in the link. When the user clicks on the link, as long as the APP that supports the link is installed on the phone, the user will be directly entered into the APP. If the APP is not installed, the H5 page is displayed in Safari. It’s a seamless jump for the user.
Details: www.cnblogs.com/guoshaobin/…
Configuration Unuversal Links
In fact, it is very simple to do, but many pits.
1. Open configuration with the Apple Developer account
2. Configure the XCode project
Turn on the Associated Domains switch and add the Universal Links domain name to the configuration
If the Associated Domains option is not available, add it.
Configure the URL Types
Configuration info. Plist, “LSApplicationQueriesSchemes” column to add
3. Configure the JSON file
Create a blank file (must be plain text, named apple-app-site-association, remove the suffix). It is recommended that background personnel create files locally to avoid problems such as file format being automatically changed and suffix automatically added during file transfer.
The following
{
"applinks": {
"apps": [],
"details": [
{
"appID": "XXXXXXX.OOOOOOO",
"paths": [ "*" ]
}
]
}
}
Copy the code
Note: XXX indicates the team ID of the Apple account, and OOO indicates the BundleID of the project.
4. Configure the background server
Put the apple-app-site-association file in the root directory of the server (don’t ask me, let the background understand) and ask him to provide an HTTPS URL in the format of “official domain name/Apple-app-site-association”, such as: www.baidu.com/apple-app-s…
The effect is that the browser opens the address and you can download the file. Also use GET to request this address and return the JSON content of the file (this is tested with the tool Postman)
Note that the returned data should not contain garbled characters, otherwise the JSON file is faulty.
5. Wechat open platform configuration
Enter the official domain name.
6. Initialize the code
// universal link [WXApi registerApp:APP_ID universalLink: UNIVERSAL_LINK];Copy the code
Additional remarks:
If the background provides the url is https://www.baidu.com/apple-app-site-association. Then, fill in applinks:www.baidu.com for Associated Domains, and fill in https://www.baidu.com/ for code registration method and wechat open platform.
WeChat login
Wechat documents, rewrite the method, applicable to iOS10 before.
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [WXApi handleOpenURL:url delegate:self];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [WXApi handleOpenURL:url delegate:self];
}
Copy the code
Add methods
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
return [WXApi handleOpenURL:url delegate:self];
}
Copy the code
Other information
www.jianshu.com/p/bb8429cd7… www.jianshu.com/p/6a25b1857… www.jianshu.com/p/c9c09992a…
www.jianshu.com/p/ab50bdaec… www.jianshu.com/p/8e8840dcd…