Since the recent (2019) project required the integration of wechat login function, and the new WXApi required Universal Links, this trip to the pit was recorded here

  • About Universal Links: Official Apple documentation

  • Reference: official wechat documents

Universal Links& wechat configuration

  1. Turn on the Associated Domains option in apple background certificate configuration Identifiers

  1. Create a file named apple-app-site-association and configure it

Note: File names do not have suffixes

{
	"applinks": {"apps": []."details":[
			{
				"appID":<[your App ID Prefix]+[your bundle ID]>."paths": ["/app/*"}]}}Copy the code

The App ID Prefix can be found in the Apple background certificate configuration Identifiers and is also the Team ID in Apple Account Membership

Paths can be defined by themselves and must end with a wildcard (*)

  1. Put the apple-app-site-association file in the root (or. Well-known) directory of your site

Apple document

  1. Test whether the configuration is successful

    1. Open Safari and type Universal Links+ random string (e.g. ABC)

    Example: https:// your url /app/ ABC

    1. If the app information is displayed and can be opened to jump to the APP, the configuration is successful

  2. Enable and set Associated Domains in TARGETS -> Signing&Capabilities of your project

  1. Add it in info.plist

  1. Enter wechat open platform -> Management Center -> Application details -> Development information fill in Universal Links

  1. Initialize WXApi using Universal Links

[WXApi registerApp:WECHAT_KEY universalLink:UNIVERSAL_LINK];