Select FluwX for the plug-in

https://pub.dev/packages/fluwx flutter in the integrated fluwx plug-in, a set of code can invoke the iOS SDK and AnZhuoWei letter of related functions

Preparations (The following describes how to configure the iOS server)

  • The first step is to configure the apple-app-site-association file, which is a JSON file with no suffix. How to determine if it is a JSON file. See below

  • The following figure shows the content of the apple-app-site-association file

  • After confirming that the first two steps are correct, communicate with o&M and put the file in the root directory or. Well-known directory of the interface server. The configuration path is as follows:

If the interface domain name is: biduo. xyz https://baidu.xyz/.well-known/apple-app-site-association put this link in your browser, I recommend opening it in Safari, Google Chrome will have a cache. There are two cases: some say open the file directly in the browser, some say download the file after entering the link. Mine is the first one, opened in a browser.

To test whether the configuration is correct, place https://baidu.xyz/.well-known/apple-app-site-association in the phone’s memo and long press if the following description appears in… “, it means correct (the premise is that the phone must have this app installed)

  • Register wechat developer platform, pay attention to a point

UniversalLinks :https://baidu.xyz/

  • Set domains in Xcode as shown below

Note: there is a problem with the nginx configuration. If the above configuration is correct, but you cannot find your app in the memo, then there may be a problem with the Nginx configuration.

Preparations are now complete. Here is the fluwX code for FLUTTER

The code in main.dart

Future initWeiXin() async {await registerWxApi(appId: "wx11111111111", doOnAndroid: true, doOnIOS: true, universalLink: 'https://baidu.xyz/', ); }Copy the code

Click the wechat login code

void requestWeChatLogin(String code) async { String commonOpenStr = await UserService().getWeiXinOpenId({ 'appid': 'wx11111111111', 'secret': 'b9e6111111111111111111111 ',(wechat open platform scecret) 'code': code, 'grant_type': 'authorization_code', });Copy the code

Wechat share code (parameters can be seen in fluwX Chinese document)

void requestWeChatLogin(String code) async { shareToWeChat(WeChatShareWebPageModel( '${widget.homeListModel.shareLink}',  scene: WeChatScene.SESSION, thumbnail: WeChatImage.asset(img('icons/share_icon.png')), title: '${widget.homeListModel.title}', description: widget.homeListModel.brief ! = null ? '${widget.homeListModel.brief}' : '', )Copy the code
  • Tip: The link shared by wechat wants to jump to Safari inside the app. Cross-domain issues need to be addressed.

For example, if the domain name of your interface is https://baidu.xyz, the link to the page you click on should not be under that domain name. It should be https://baidu.aaa