Initialization
Unity3D
Outline
Access Guide
MSDKPolicy
TargetAPI 28
MSDK permission list
FAQ
Android
Outline
Access Guide
MSDKPolicy
TargetAPI 28
MSDK Android permission list
FAQ
IOS
Outline
Access Guide
Universal Link
MSDK iOS permission list
FAQ
Others
Data Structure
System Tools
Access Configuration / Unity3D / Outline

Outline

Unity engine and its ecosystem provide the world's first-class cross-platform game development platform, so that the multi- platform game is developed more quickly and efficiently. An increasing number of developers now use Unity engine to develop games.

MSDK for Unity leverages Unity engine's strong cross-platform ability to unify the MSDK of Android and iOS versions, shield the platform differences, and provide Unity games with consistent access experience. Also, MSDK for Unity provides a series of auxiliary access plug-ins. For example, by using the MSDK deployment plug-in, you can complete the MSDK configuration and deployment work by operating one button after filling the simple game information, and you can use capabilities provided by MSDK through writing a few C# codes.

MSDK for Unity offers a number of value-added capabilities, including notice system, inside webview, Pigeon push, data reporting, LBS and Crash analysis, in addition to providing login, friend relation chain, share, joining & binding groups and other capabilities. These value-added modules enable game developers to easily build extra capabilities for games and to be more focused on the user experience of the games themselves, thus bringing better games for players.

Access Guide

1 Preconditions

1) At first, you need to confirm that you have acquired MSDK Unity version. If you have not acquired it, click the link below to download it.

Download MSDK for Unity

2) It is needed to have installed the Java environment and configured the environment variables.

Configure system variables (please refer to):
JAVA_HOME : D:/Program Files/java/jdk1.6.0_25
Path : C:\Windows\system32;C:\Windows;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
CLASSPATH : .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
For more detailed steps, please search "Java environment variable configuration"

3) MSDK for Unity needs Unity4.6.3 or higher versions.

2 Import MSDK

MSDK's Unity version includes Exampleand version content Msdk. By following the following steps, you can quickly import MSDK.

1) Click on the Unity3D menu : Assets->Import Package->Custom Package...
2) Select MSDK's Unity version package : MSDK_Unity_<version>.unityPackage

Of which, version code is version, such as: MSDK_Unity_1.0.3u.unityPackage.

3 Deploy MSDK

After importing MSDK, you can see the "MSDK" menu at Unity's menu bar. Follow the following steps to deploy MSDK.

Deployment menu

1) Click MSDK->Deploy Settings in succession. The Inspector panel will display MSDK deployment panel MSDK deployment panel
2) Fill the game information on the MSDK deployment panel (package name, mobile QQappid, WeChat appid, etc)
3) Click the button "Deploy MSDK" on the lower part of the deployment panel to complete the MSDK deployment
4) On the Project panel, right click the Plugins directory, select Refresh, and make Unity complete the loading of MSDK file

Of which, MSDK deployment panel's game information is required, and you can get it at the Flying Eagle System (dev.ied.com) through your game operation manager.

MSDK deployment panel's entry description

field description
Package Name game package name
MsdkKey ID used for the interaction between the MSDK frontend and the backend of the game
QQAppId game's AppId at mobile QQ open platform
QQAppKey game's AppKey at mobile QQ open platform
WXAppId game's AppId at WeChat open platform
Android OfferId Midas platform Android payment Id,OfferId is required, and it is directly registered on mizu's official website midas.qq.com to generate offerId.If you are not a registered midas, you can fill in the appid of mobile QQ temporarily,the offerid generated by the midas is used after registration. If the offerid is not filled in, the login will fail
iOS OfferId Midas platform iOS payment Id.
Internal self-developed games: directly register iOS apps at the Midas official website midas.qq.com to generate offerid .
External agented games: the game product should first apply for the Apple information at the RDM official website rdm.oa.com,
after the application, send the information to the collaboration & planning group's staffer jiaganzheng, who will typeset the information into dev backend ,
then, the developer shall add IAP version in the management center; after all these, the offerid will be generated
ENABLE MSDKPolicy Data compliance plugin switch; if you need to use it, you need to check it

Precautions

1) If your game information changes, you should redeploy MSDK according to Step 2.
2) Before the deployment of MSDK, if there are two files (namely "AndroidManifest.xml", "project.properties") in the "Assets/Plugin/Android" directory, the two files will not be replaced at the time of MSDK deployment, and the back-up copies "Copy_AndroidManifest.xml", "Copy_project.properties" will be generated. You need to refer to the copy files to modify "AndroidManifest.xml" and "project.properties" manually.

3) xcode project exported from Unity must be connected with the real device for debugging.
4) In the callback information returned by MSDK, all the string encoding is standard UTF8 encoding.

4 Configure the game information

Click in succession MSDK->Config Settings to call MSDK module configuration panel, including environment selection, notice switch, and push switch, etc. Nearby each configuration entry there is one question mark. If moving the mouse onto this entry, detailed configuration explanation will be displayed.

MSDK configuration panel

MSDK configuration panel's entry description

Field Platform Description
MSDK_ENV Android/iOS environment selection; MSDK can choose the test environment in case of joint debugging; after its official release, it must choose the formal environment
WXTOKEN_REFRESH Android/iOS MSDK WeChat's switch for automatically refreshing the token; for more details, please refer tologin module
PUSH Android/iOS Pigeon push function switch
needNotice Android/iOS MSDK notice function switch
noticeTime Android/iOS MSDK notice system's notice data update time(notice data requested when going online), in minutes (minimum 5 minutes)
realNameAuth Android/iOS real-name authentication configuration(3.2.14 and higher versions must configure it as 1);
0:use MSDK real-name authentication UI, and return back to the login page after authentication;
1:use MSDK real-name authentication UI, and login to the game after authentication;
2:use the game-defined authentication UI, and call back to the game after authentication;
Webview Config Android/iOS MSDK inside webview slide hideable switch configuration;
Portrait Hideable: when the browser displays in portrait, the navigation bar is slide hideable or not? (true indicates slide hideable);
Landscape Hideable: when the browser displays in landscape, the navigation bar is slide hideable or not?
BETA Android MyApp number-grabbing function switch
STAT_LOG Android/iOS Beacon, Bugly and QQ OpenSDK log switch. When it is set to true, detailed logs will be printed. When an app is officially released, it is needed to set the switch to false; iOS Beacon and Bugly support from version 3.3.19; 3.3.271 version starts to support QQ OpenSDK
CLOSE_BUGLY_REPORT Android Close Bugly reporting switch; the switch is set to true, meaning to turn off the Crash reporting function
SAVE_UPDATE Android MyApp traffic-saving download and update function's switch
GRAY_TEST_SWITCH Android white list limit switch; if you want to reserve number-grabbing, you need to apply for it from the collaboration & planning group
localLog Android This configuration has been removed in 3.x versions
SDKLog switch; 0: don't print; 1: print logcat; 2: print to local file; 3: print logcat and local file at the same time; the printed local file is saved in SDCard/MSDK/msdk.log (for versions later than 2.16.0a, save in /sdcard/Android/data/package name/files/MSDKLog.log.0)
Use C11 Library iOS Use the library compiled by C11 or not? (Unity5 packaging needs to use the library compiled by C11)
Check Config Android/iOS Use MSDK configuration check plug-in or not? MSDK configuration check plug-in will check if relevant MSDK configurations are correct when Unity packages Android/iOS
SCOPE Android/iOS Extended WeChat scope field; multiple scopes are separated with ", "; version 2.18.0 starts to support this,Refer to this field description in Android/iOS for specific configuration
V2SIGNING_ENABLED Android V2 signature switch; packages enabling V2 signature must open this switch (failure to open the switch can lead to the channel number read error); if it is null, it is “OFF” by default
V3SIGNING_ENABLED Android V3 signature switch; this switch must be turned on for packages which use V3 signature (otherwise, a channel number reading error will occur); 'true' means 'enabled'; if it is not filled in, the switch is turned off by default; Version 3.3.15 starts to support it
IPV6_SUPPORT Android/iOS Whether or not to support IPV6? Set the value as true, meaning to support IPV6; false means not to support it; 3.3.0 version starts to support the field
BEACON_SENSOR_ENABLE Android Whether to enable BeaconID acquisition; true means "enable", false means "disable"; it is supported since version 3.3.9, and enabled by default since version 3.3.18; this configuration has been removed since version 3.3.21
BEACON_CC_ENABLE Android Whether to enable anti-cheat, which is disenabled by default; "true" means to enable the switch, and "false" means to disenable it; the switch is supported since version 3.3.9
BEACON_PAGE_PATH_ENABLE Android Whether to enable page tracking, which is disenabled by default; "true" means to enable the switch, and "false" means to disenable it; the switch is supported since version 3.3.9
MSDK_PUSH_AT_FOREGROUND iOS XG adds the front-end push switch, which is off by default
MSDK_Webview_Force_Adapt_Bang_Screen iOS Built-in Webview full-screen configuration switch; if the switch is configured to 'true', MSDK's built-in WebView will be displayed in full screen when it is in the landscape mode; if the switch is configured to 'false' or not configured, MSDK's built-in WebView behavior will be consistent with that of the previous version. Version 3.3.11 starts to support this switch
XG_OTHER_PUSH_ENABLE Android Whether to enable Tencent mobile push vendor channel, which is disabled by default; 'true' means 'enabled', and 'false' means 'disabled'; Version 3.3.11 starts to support it
XG_OTHER_PUSH_XIAOMI_APPID Android Fill in the appId of the Xiaomi channel; version 3.3.11 starts to support it
XG_OTHER_PUSH_XIAOMI_APPKEY Android Fill in the appKey of the Xiaomi channel; version 3.3.11 starts to support it
XG_OTHER_PUSH_MEIZU_APPID Android Fill in the appId of the Meizu channel; version 3.3.11 starts to support it
XG_OTHER_PUSH_MEIZU_APPKEY Android Fill in the appKey of the Meizu channel; version 3.3.11 starts to support it
XG_OTHER_PUSH_OPPO_APPID Android Fill in the appKey of the OPPO channel; version 3.3.11 starts to support it
XG_OTHER_PUSH_OPPO_APPSECRET Android Fill in the appSecret of the OPPO channel; version 3.3.11 starts to support it
MSDK_WEBVIEW_LOADING_BACKGROUND_COLOR Android/iOS A switch used to load the loading page when opening Webview; the loading of the loading page is not enabled if the field is not configured or set to ""; if the field is configured, the loading page that carries the background color will be enabled and it is needed to fill in a hexadecimal color value in a format of not including transparency, such as: #000000; version 3.3.12 begins to support this function
XG_PULL_UP_OTHER_APP_ENABLE Android A switch for Tencent Mobile Push's joint survival capability; 'true' means 'enabled', and 'false' means 'disabled'; it is disabled by default to prevent its own app from waking up other apps; Version 3.3.13 starts to support it
MSDK_BUGLY_BLOCK_MONITOR_ENABLE iOS Bugly block monitoring configuration switch; when the switch is set as 'true', this means 'enabled'; if it is not configured, it will be disabled by default; 3.3.15 version starts to support it
MSDK_BUGLY_BLOCK_MONITOR_TIMEOUT iOS After Bugly block monitoring is enabled, you need to configure the block monitoring judgment interval, whose unit is second; it is default as 5 seconds if it is not set; 3.3.15 version starts to support it
MSDK_CENTER_CONTROL_WEBVIEW_LOADING_BACKGROUND_COLOR Android/iOS A switch for the background color of the loading page loaded when the central control Webview is opened; the default color is: #010C0F; 3.3.16 version starts to support it
CLOSE_BEACON_REPORT Android/iOS Beacon reporting switch, which is set to false by default; if it is set to true, this means to turn off the Beacon reporting function; if it is not configured, it is defaulted as 'enabled'; 3.3.17 version starts to support it
CLOSE_HTTPDNS Android/iOS HttpDns switch, which is defaulted as false; if it is set to true, this means to close the HttpDns function; if it not configured, it is defaulted as 'enabled'; 3.3.17 version starts to support it
BUGLY_REPORT_URL_ANDROID Android Bugly's self-defined Server Url configuration, which is used for the migration from Bugly to CrashSight. Before migration, please make sure that 'appId' has been configured in the CrashSight backend console (add the corresponding item). After triggering a crash or Bugly log, please go to CrashSight Console for verification. Example: BUGLY_REPORT_URL_ANDROID = https://test-astat.bugly.qcloud.com/rqd/async; Version 3.3.19 starts to support it
BUGLY_REPORT_URL_IOS iOS Bugly's self-defined Server Url configuration, which is used for the migration from Bugly to CrashSight. Before migration, please make sure that 'appId' has been configured in the CrashSight backend console (add the corresponding item). After triggering a crash or Bugly log, please go to CrashSight Console for verification; 3.3.19 version starts to support it
MSDK_DENIED_COLLECT_LIST Android Apn&AndroidID&QImei&QImei36 collection configuration switch; the fields that are not allowed to be collected can be configured in this configuration item (multiple fields are connected with English commas), and the collection of them is allowed by default if they are not configured; supported since version 3.3.25
CLOSE_BUGLY_CALLBACK Android/iOS Crash reporting callback and error reporting callback switches (iOS only supports the configuration of the Crash reporting callback switch); if they are set to false, this means to enable the callbacks; if they are set to true, this means to disable the callbacks; if they are not configured, the callbacks will be enabled by default. 3.3.26 version starts to support them
DELETE_ACCOUNT_URL_TEST Android/iOS The account cancellation page's test environment url, currently configured as: https://gacc-account-web-test.odp.qq.com/writeoff.html; 3.3.271 version starts to support this
DELETE_ACCOUNT_URL_RELEASE Android/iOS The account cancellation page's release environment url, currently configured as: https://gacc-account-web.odp.qq.com/writeoff.html; 3.3.271 version starts to support this
QQSdkWebviewScreenDir iOS In iOS16, if the QQ client is not installed, this configuration can solve the problem that a landscape mode game cannot switch back to the landscape mode when the screen returns to the game after the game invokes QQ website for the player to log in. If the following configuration values are obtained, they mean: 0: screen orientation neutral, 1: landscape mode, 2: portrait mode. If the above configuration values are not obtained, the screen orientation that exists when APP logs in will be obtained. If the screen orientation exists, the obtained screen orientation will be returned. Otherwise, screen orientation neutral will be returned. 3.3.271 version starts to support this

2.16.0 and above; Precautions:

If MSDK is upgraded to 2.16.0 from an earlier version, the configuration file msdkconfig.ini needs to make the following changes

1. Add MSDK's domain name configuration (the game does not need to modify it but directly copy it into the configuration file)

;the following configuration is for MSDK's internal use, and game developers don't need to pay attention to it
MSDK_ENV_TEST_URL=http://msdktest.qq.com
MSDK_ENV_RELEASE_URL=http://msdk.qq.com

2. Add domain name selection configuration (The game chooses the right environment according to the situation)

;selection of the formal environment and the test environment; "test" means the test environment, and "release" means the formal environment 
MSDK_ENV=test

3.Delete the original domain name configuration scheme(delete MSDK_URL=xxxxx

;selection of the formal environment and the test environment; msdktest.qq.com is the test environment's domain name, and msdk.qq.com is the formal environment's domain name 
MSDK_URL=http://msdktest.qq.com (delete)

Please refer to MSDKDemo's configuration file

IDFA iOS 14 description

Applicable version: MSDK V3.3.15 and later versions

In iOS 14, Apple has further tightened user privacy permissions. When you collect IDFA, a user authorization pop-up window will pop up and you are required to add a new configuration in info.plist and to fill in the purpose of collecting IDFA. Developers can call the IDFA acquisition interface as needed to pop up a notification for the user, asking the user whether to authorize this. If the user does not authorize this, the collected IDFA will be a string of meaningless 00000-000000000-000000. IDFA acquisition is modularized. By adding MSDKSensitivity.framework, developers can access this function on demand.

  • Xcode-Build Phases-Link Binary With Libraries adds AppTrackingTransparency.framework.
  • In the info.plist file, add a key-value pair, where the key is Privacy-Tracking Usage Description and the value is the reason for using IDFA.

Call the following API to pop up an authorization pop-up window for the user:

#import <AppTrackingTransparency/AppTrackingTransparency.h>
if (@available(iOS 14.0, *)) {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
        
    }];
}

MSDK has provided a switch for compatible IDFA collection since version 3.3.16, as follows:

Add a key-value pair to the info.plist file of the development project, where the value is MSDK_APP_TRACKING_ENABLE and the value is YES or NO

  • YES: The game still needs to call the above AppTrackingTransparency.framework API when necessary to pop up an authorization pop-up window for the user, asking whether the user allow the IDFA collection. MSDK can also call the relevant API to query the user's authorization status. Only the user authorizes this can the interface be called to obtain IDFA; otherwise MSDK will directly return a meaningless string like 00000-000000000-000000.
  • NO: MSDK directly calls Apple API's IDFA acquisition interface.

The default behavior of not adding MSDK_APP_TRACKING_ENABLE is NO.

If you want to delete the IDFA related functions of MSDK itself, do the following operations:

  • Delete the declaration of IDFA in info.plist
  • Delete MSDKSensitivity.framework
  • Delete AdSupport.framework
  • Delete AppTrackingTransparency.framework

CAID description

Applicable version : MSDK V3.3.17 and later versions

CAID: It is a set of IOS device ID for domestic advertising collaborative promotion. After Apple's IDFA cannot be read, CAID solves the advertising attribution problem. The Unity version script automatically integrates tgpasimple.framework that CAID depends on. If your game does not require the CAID capability, you can remove the TGPA component tgpasimple.framework by yourself.

Warning:

  • The acquisition and reporting of CAID only supports iOS 9.0 and above systems. The TGPA component of systems below iOS 9.0 cannot obtain CAID.
  • Because the acquisition of CAID requires access to the network, the acquisition and reporting of CAID may fail for the first-time installation or reinstallation scenario. After the failure, CAID can be re-acquired, and it will be visible next time you start to log in.

5 Initialize code

1) Import MSDK libraries

Import MSDK libraries in the C# script that needs to use MSDK interfaces

using Msdk;

2)Set PC debugging pile environment

PC debugging pile environment is the virtual environment customized by MSDK for Unity version, and it will return the virtual MSDK data (login callback, notice data etc.) at the time of debugging in PWindows and Mac environment. That will facilitate the game to quickly validate MSDK's relevant logics in the computer.

a) Open PC debugging pile environment in the script.

WGPlatform.SetPCDebug(true);

b) Click in succession MSDK -> PC Environment Settings in the MSDK menu, and set the virtual callback results of events such as login and sharing on the Inspector panel so as to validate the game logic.

3) Register login callback and platform launch callback

Because the login callback and the platform launch callback can be invoked when the game does not call relevant interfaces, they need to be registered before the game initializes MSDK. - Login callback: As for the login event result notification, the login state of the game in mobile QQ/WeChat is based on login callback. As for the detailed settings, please refer to the login modulecallback settings. - Platform launch callback: If a game is launched in mobile QQ/WeChat, it will return to this callback, which contains the launched account, the platform's passthrough data, etc. For detailed settings, refer to the login moduleAccount inconsistency handling

MsdkEvent.Instance.LoginEvent += (LoginRet loginRet) =>
{
    switch (loginRet.flag)
    {
    case eFlag.eFlag_Succ:
    // Login succeeds; various tokens can be read
    // Game TODO:Enter the game
        int platform= loginRet.platform;
        if((int) ePlatform.ePlatform_Weixin == platform) {
            loginState = "WeChat login succeeds";
        } else if((int) ePlatform.ePlatform_QQ == platform) {
            loginState = "QQ login succeeds";
        } else if((int) ePlatform.ePlatform_QQHall == platform) {
            loginState = "Hall login succeeds";
        } else if((int) ePlatform.ePlatform_Guest == platform) {
            loginState = "Guest login succeeds";
        }
        break;

    // Game TODO:Login failure cases should be handled, respectively. In such cases, the handling way is generally to return back to the login page and to guide the user to reauthorize
    case eFlag.eFlag_QQ_UserCancel:
    // The player cancels authorization
    case eFlag.eFlag_QQ_LoginFail
    // QQ Login failed
    case eFlag.eFlag_QQ_NotInstall
    // QQ is not installed
    case eFlag.eFlag_Local_Invalid:
    // Automatic login failed, due to the local token expiration, refresh failure and other errors
    case eFlag.eFlag_WX_UserCancel:
    // The player cancels authorization
    case eFlag.eFlag_WX_NotInstall:
    // WeChat is not installed
    case eFlag.eFlag_WX_NotSupportApi:
    // WeChat version is not supported
    case eFlag.eFlag_WX_LoginFail:
    //WeChat Login failed
    default:
        loginState = "Login failed";
        message = loginRet.ToString();
        break;
    }
};

MsdkEvent.Instance.WakeupEvent += (WakeupRet wakeupRet) =>
{
    // TODO GAME Add the logic to handle account inconsistency here
    if (eFlag.eFlag_Succ == wakeupRet.flag || eFlag.eFlag_AccountRefresh == wakeupRet.flag) {
        // After the local account login succeeds, directly enter the game
        // Game TODO:Enter the game logic
        if((int) ePlatform.ePlatform_Weixin == wakeupRet.platform) {
            loginState = "WeChat login succeeds";
        } else if ((int) ePlatform.ePlatform_QQ == wakeupRet.platform) {
            loginState = "QQ login succeeds";
        } else if((int) ePlatform.ePlatform_QQHall == wakeupRet.platform) {
            loginState = "Hall login succeeds";
        }
    } else if (eFlag.eFlag_UrlLogin == wakeupRet.flag) {
        // The local has no account information. Automatically login the game with the launched account. The login result is called back in OnLoginNotify()
    } else if (eFlag.eFlag_NeedSelectAccount == wakeupRet.flag) {
        // Game TODO:In case of account inconsistency, the game needs to pop up a prompt box to allow the user to select the account needing to login and calls WGSwitchUser interface according to the user's choice
        Debug.Log("diff account");
        isShowDiffAcount = true;
        message = "Account inconsistency!";
    } else if (eFlag.eFlag_NeedLogin == wakeupRet.flag) {
        // Game TODO: No valid token. Logout of the game so that the user re-login the game
        loginState = "Login failed";
        message = "Please re-login";
    } else {
        loginState = "Not login";
        message = "OnWakeupNotify    flag : " + wakeupRet.flag + "\ndesc : " + wakeupRet.desc;
        WGPlatform.Instance.WGLogout();
    }
};

4) Initialize MSDK's C# layer and set mobile QQ's authorization permissions

Initialize MSDK's C# layer and set mobile QQ's authorization permissions, that is, complete Unity version's initialization operation. After this, call MSDK interfaces according to each module's description; and according to 5, pack the game package and verify the real environmental results.

WGPlatform.Instance.Init();
WGPlatform.Instance.WGSetPermission(ePermission.eOPEN_ALL);

Note:

If WGSetPermission is not called, this may lead to the "100030" error when mobile QQ friends are drawn. For details, please refer to the login module's Outline part's Authorization page description.

6 Export the game package

After completing MSDK deployment and configuration, you can directly export the game's Android installation package or iOS Xcode project.

Android

As for Android packaging, there are three methods for reference. First, directly export the Apk package from Unity; this is the most convenient way; if the native code needs to be modified, it is suggested to export the game's Jar package with the third method and then to export Apk from Unity. This has better compatibility and can facilitate the game to update the version and SDK.

1) Export Android installation package

If the game doesn't need to modify Android's native code, directly export Apk installation package from Unity, as detailed below:
a)    Modify information like game appid, click "Deploy MSDK", and modify the information of AndroidManifest.xml file by comparing with Copy_AndroidManfest.xml file
b)    Click File->Build Settings... and call out Unity's compiling setting panel
c)    In Platform entry, select Android platform, click Play Settings... configure Android packaging information
d)    In "Other Settings" entry, configure game package name (Bundle Identifier) and version (Bundle Version, Bundle Version Code)
e)    In Publishing Settings, configure the game's Keystore certificate (MSDKSample certificate is located in Assets/Example/debug.keystore, and the password is android, alias is androiddebugkey, alias password is android)
f)    On the Build Settings panel, click Build to export the Android installation package

2) Export Android project

If the game needs to access other Android native components or modify the java code, follow the following method to export the Android project and make modification:
a) Modify information like game appid, click“Deploy MSDK”, and modify the information of AndroidManifest.xml file by comparing with Copy_AndroidManfest.xml file
b) Click File->Build Settings... and call out Unity's compiling setting panel
c) In the Platform entry, select Android platform, tick "Google Android Project", and click Export to export the Android project
d) Use Eclipse to open the exported Android project, newly create one Activity and implement com.tencent.msdk.adapter.MsdkActivity
e) In AndroidManifest.xml, adjust the start Activity into the newly created Activity, and then freely integrate other components and modify the java code

Note:

1) Do not forget to declare new Activities in AndroidManifest.xml 2) When overriding Activity's lifecycle, please call the parent class's lifecycle, for example:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ……
}
3) The game defines the native code, exports the Jar package and integrates the package into Unity to export the Apk

a) First of all, the game needs one Android project (newly created or existing)
b) In Unity IDE's MSDK deployment panel, configure the game information, click "Deploy MSDK", and modify the information of AndroidManifest.xml file by comparing with Copy_AndroidManfest.xml file
c) To facilitate the Android project in Step 1 to call Unity and MSDK's native interfaces, it is necessary to add Unity and MSDK's Jar packages into /libs directory

Unity native Jar package: Assets/Msdk/Editor/Librarys/Android2.14/UnityClasses.jar (or use the Jar package in Unity installation directory)
MSDK native Jar package: Assets/Plugins/Android/MSDKLibrary/libs/MSDK_Android_.jar (such as, MSDK_Android_2.14.4a_svn69363.jar)
MSDK Unity configuration Jar package: Assets/Plugins/Android/libs/msdk_unity_adapter_.jar (such as, msdk_unity_adapter_1.0.4u.jar)

d) In the Android project in Step 1, newly create MainActivity class, which implements com.tencent.msdk.adapter.MsdkActivity class. Start entrance Activity is set as MainActivity. In this Android project, realize and call various kinds of native methods and interfaces.
e) After calling the native methods in the Android project, export the native code of the game as Jar package, and place the package in Assets/Plugins/Android/libs, so as to be integrated into the game's Apk.

iOS

In terms of iOS packaging, it is necessary to first use Unity to export Xcode project in MacOS, and then compile the ipa game installation package in Xcode.

Export Xcode project

After exporting Xcode project from Unity, use Xcode to open and modify the signature certificate and then compile, run or export the installation package.

a) In the Build Settings panel's Platform entry, select iOS platform, click Play Settings... configure iOS packaging information
b) In Other Settings entry, configure game package name (Bundle Identifier) and version (Bundle Version), Scripting Backend, select IL2CPP and Target iOS Version ( 6.0 and above)

c)On the Build Settings panel, click Build to export Xcode project
d) In the Xcode project configuration, select in succession Build Settings->Code Signing. In the Code Signing Identity, configure the game's iOS certificate, and then compile and run the game

Android MSDKPolicy

1 MSDKPolicy Plugin

3.3.15a version starts to add a data compliance plugin. MSDKPolicy is a universal Android data permission compliance process implementation scheme. It integrates user privacy protocol and permission authorization process, and provides quick access for games through the form of configuration. Games can incorporate the plugin into them according to their own needs.User Agreement Update Reference Documentation:https://docs.qq.com/doc/DSnlkYU5SZWhPYmNR

Important: If your project needs to access TDM component, you need to upgrade TDM to a compliant version: V1.9.000 or above.

The process of MSDKPolicy is as follows:

1.1 Import a plugin

Check ENABLE MSDKPolicy in the MSDK deployment panel. After MSDK is deployed, you need to adjust the startup Activity to MSDKPolicyActivity. An example is as follows:

    <!-- MSDKPolicy data compliance component configuration -->
    <activity android:name="com.tencent.gcloud.msdk.core.policy.MSDKPolicyActivity"
        android:configChanges = "keyboard|keyboardHidden|screenLayout|screenSize"
        android:launchMode="singleTask"
        android:theme="@style/MSDKPolicyTheme">
        <intent-filter>
<action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
        </intent-filter>
        <!--  MSDK_POLICY_TARGET_ACTIVITY is used to specify the first Activity of the app or game that needs to be jumped to at the end of the compliance process-->
        <meta-data
            android:name="MSDK_POLICY_TARGET_ACTIVITY"
            android:value="com.example.wegame.MainActivity" />
        <meta-data android:name="MSDK_POLICY_DEBUG" android:value="true"/>
        <!-- In order to comply with the latest compliance process requirements, MSDK_RESULT_FILE_NAME configuration is closed by default since version 3.3.19 -->
        <!-- After this configuration is removed, if the user did not agree to the protocol before, the protocol will be popped up in the case of overwriting installation no matter whether the user has logged in before overwriting installation -->
        <!-- If your game is newly connected to MSDKPolicy, it is also recommended to comment out the MSDK_RESULT_FILE_NAME configuration below to meet the latest compliance requirements -->
        <!--<meta-data android:name="MSDK_RESULT_FILE_NAME" android:value="WEGAMEDB2"/> -->
        <meta-data android:name="IS_MSDK_V5" android:value="false"/>
        <!-- If the game does not want to upgrade to the compliant version of TDM, you need to set the following MSDK_POLICY_TDM_REPORT_DISABLE switch to true. Note that after it is turned on, the MSDKPolicy process will not do TDM reporting, and the process cannot be tracked-->
        <meta-data android:name="MSDK_POLICY_TDM_REPORT_DISABLE" android:value="false" />
        <!-- It is used to mark the protocol version. If the protocol is updated, it will be added up. Please fill in the integer value -->
        <meta-data android:name="MSDK_POLICY_VERSION" android:value="1" />
    </activity>

Warning:

  • MSDK_POLICY_TARGET_ACTIVITY is used to specify the first Activity of the app or game that needs to be jumped to at the end of the compliance process. The value of the MSDK_POLICY_TARGET_ACTIVITY parameter needs to be adjusted to the startup activity of the game by then.
  • Please keep the remaining parameters consistent with the example.
  • Please use android: screenOrientation to configure the screen orientation of MSDKPolicyActivity to be the same as that of your game or app for a better experience.
  • In order to comply with the latest compliance process requirements, MSDK_RESULT_FILE_NAME configuration is closed by default since version 3.3.19. After this configuration is removed, if the user did not agree to the protocol before, the protocol will be popped up in the case of overwriting installation no matter whether the user has logged in before overwriting installation. If your game is newly connected to MSDKPolicy, it is also recommended to comment out the 'MSDK_RESULT_FILE_NAME' configuration below to meet the latest compliance requirements.
1.2 Related documents
  • msdk_policy_content.html
    It is used to configure the content of the agreement. A default agreement reviewed by the legal department has been provided
  • msdk_permission_content.html
    It is used to configure the permission list and usage instructions required by App. The current content is used for Demo. You need to modify it according to the actual situation of your app. The necessary permissions need to be placed in the front and given with a highlighted prompt like (Required)
  • Msdk_permission_list in values.xml
    It is used to configure the necessary permissions for polling in the permission application process. During the polling process, the necessary permissions will be applied for from the user
1.3 MSDKPolicy is divided into two parts

User privacy protocol:

When the user clicks the App icon to start the game, the user privacy protocol (as shown above) will be launched. The protocol content in the figure can be configured. Currently, a set of default protocol is provided for games. If you want to modify it, please contact the Legal Department to confirm the risk assessment. The protocol content can be configured in the resource file 'MSDKPolicy/assets/msdk_policy_content.html'. Only basic html tags are supported. If chess and card games access it, please contact the Legal Department to confirm the protocol and link address of chess and card games by themselves, and make adjustments accordingly.

<!doctype html>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width initial-scale=1'>
    <title></title>
</head>

<body>
<p>Before you use our (Tencent) services, please read carefully and fully understand the terms of the <a href='http://game.qq.com/contract.shtml'>Tencent Games License and Service Agreement</a>, <a href='http://game.qq.com/privacy_guide.shtml'>Tencent Games Privacy Protection Guidelines</a> and <a href='https://game.qq.com/privacy_guide_children.shtml'>Tencent Games Children's Privacy Protection Guidelines</a> and <a href="https://game.qq.com/zlkdatasys/privacy_SDK.html">Third Party Information Sharing Checklist</a> the terms of.<strong>At the same time, you should pay special attention to the clauses that exempt or limit our liabilities, the clauses that restrict your rights, and the clauses stipulating dispute resolution and jurisdiction in the aforementioned agreement. </strong>If you have read in detail and agree to the <a href='http://game.qq.com/contract.shtml'>Tencent Games License and Service Agreement </a>, <a href='http://game.qq.com/privacy_guide.shtml'>Tencent Games Privacy Protection Guidelines</a> and <a href='https://game.qq.com/privacy_guide_children.shtml'>Tencent Games Children Privacy Protection Guidelines</a> and <a href="https://game.qq.com/zlkdatasys/privacy_SDK.html">Third Party Information Sharing Checklist</a> please click "Agree" to start using our services. </p>
</body>

</html>

Required permission application process:

After clicking the "Agree" button, the user enters the permission request page and starts the necessary permission application process, as shown in the following figure:

The content of the permission description page can be configured. Developers need to sort out all the permissions of their own App and list them in the configuration. Among them, the required permissions need to be clearly marked as shown in the above figure. The configuration file is MSDKPolicy/assets/msdk_permission_content.html. Only basic html tags are supported. The following is just an example. Developers need to sort out all the permissions of their own App.

<p>In order to ensure your gaming experience, we will apply for the following permissions during your use of our service. By then, you can choose to agree or refuse to open the relevant permissions. If you refuse, this will affect some functions:</p>
<br/>
<p><strong>Save permissions </strong></p>
<p>Cache images/videos to reduce traffic consumption</p>
<br/>
<p><strong> Device/phone permissions </strong></p>
<p>Verify IMEI&IMSI code to prevent account theft</p>
<br/>
<p><strong>Location permission </strong></p>
<p>Get your location information, so that you can play with nearby players</p>
<br/>
</ul>

When the user clicks the "Confirm" button on the permission request page, the application process of required permissionstarts.

During this process, users will be polled to obtain required permissions. Developers need to configure the required permissions needed by their own App to the msdk_permission_list of MSDKPolicy/res/values/values.xml. The following is just an example. Developers need to sort out all the required permissions needed by their App, for example:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <array name="msdk_permission_list">
        <item>android.permission.ACCESS_FINE_LOCATION</item>
    </array>
</resources>

The required permission for the geographic location are configured in this example. Then, there will be a pop-up box in the above figure to apply for this permission (if not authorized).

Starting from V3.3.25, msdk_permission_content.html has supported configuration.

If msdk_permission_content.html is set empty or is deleted, the "permission description" page will not be popped up. After the user clicks the "Agree" button on the agreement page, he will directly enter the game.

1.4 Test and verification
  • After the user clicks "Agree" on the agreement page, TDM will start to report the in-app event tracking data and the device information. You can contact MSDK Assistant to assist in verification;
  • The required permissions in values.xml need to be consistent with the highlighted (required) permissions in msdk_permission_content.html;
  • Critical path test: After the access is completed, you must do a critical path test. Paths such as login & relationship & sharing & game center start & account inconsistency must be covered in the test.

2 Switch Configuration Interface

Android 3.3.21 Version/iOS 3.3.22 Version add this interface,After the user agrees to the terms of the user agreement, the business can call this interface to enable MSDK and the third-party components included in the MSDK (currently, there are beacon and TBS components that support this capability) to obtain relevant information; MSDK will not obtain the relevant information until the switch is turned on. Related Information. The interface description is as follows:

java:
MSDKSensitive.setCouldCollectSensitiveInfo(true);

c++:
/*
 * Set whether to allow access to related information
 */
void WGSetCouldCollectSensitiveInfo(bool couldCollect);

Warning:

  • Before MSDK is initialized, you can call the Java interface to turn on the switch in advance to avoid some data reporting from missing sensitive information fields.
  • If the Java interface is not called before MSDK is initialized, the C++ interface must be called after MSDK is initialized.
  • Multi-process scenes are not supported. It is recommended to place all the calls for internal policy optimization related interfaces into the main process, or the child process calls the related interfaces of the component by itself.
  • 【Warning】QQ OpenSDK 3.5.7 version has updated permission-related functions. The accessing party cannot use QQ OpenSDK's functions before calling WGSetCouldCollectSensitiveInfo. The log will print "The user is not authorized and is temporarily unable to use QQ login and sharing functions".

3 Set Info Field Interface

Android 3.3.21 Version/iOS 3.3.28 Version adds a new interface for setting the information field,After the user agrees to the terms of the user agreement, the service can obtain the relevant information fields by itself, and call this interface to set up the MSDK and the third-party components included in the MSDK (the lighthouse component currently supports this capability). The interface description is as follows:

java:
MSDKSensitive.setSensitiveInfo("{\"AndroidID\":\"xxx\", \"WiFiMacAddress\":\"xxx\", \"Model\":\"xxx\", \"Oaid\":\"xxx\", \"Imsi\":\"xxx\", \"Cid\":\"xxx\"}");

c++:
/*
 * Set the information fields to each component SDK in the json form; currently support{"AndroidID":"xxx","WiFiMacAddress":"xxx","Model":"xxx","Oaid":"xxx","Imsi":"xxx","Cid":"xxx"}
 */
void WGSetSensitiveInfo(const char *jsonInfo);

Warning:

  • Before MSDK is initialized, you can call the Java interface to set relevant information in advance to avoid some data reporting from missing relevant information fields.
  • If the Java interface is not called before MSDK is initialized, the C++ interface must be called after MSDK is initialized.
  • The AndroidID field must be set; otherwise, the Beacon data statistics will be affected.
  • Beacon, QQ-Connect OpenSDK, and Bugly all need to be passed in Model; Model is not empty (QQ-Connect OpenSDK supports it from version 3.3.281, and Bugly supports it from version 3.3.29)

4 Apn & AndroidID & QImei & QImei36 collection configuration interface switch

Version 3.3.25 Add Apn & AndroidID & QImei & QImei36 collection configuration interface switch;based on their own needs, games can configure whether these fields are allowed to be collected (this interface function is the same as the MSK_DENIED_COLLECT_LIST configuration item in the msdkconfig.ini file, but its priority is higher than the latter's). The interface description is as follows:

    /**
    *  Set the special information single-field switch in the form of json; its priority is lower than that of the general switch; currently support setting AndroidID, Apn, QImei and QImei36
    * Parameter example{"AndroidID":true,"Apn":true,"QImei":true,"QImei36":true}
    *
    */
    void WGSetCollectSensitiveInfo(const char *jsonInfo);

Target API 28 Upgrade Guide

1. Background

Google Play Store requires Apps that go online after August 2019 and are updated after November must upgrade their Target API to Target API 28

Official reference materials:

> When you upload an APK, it needs to meet Google Play's target API level requirements. Starting August 1, 2019, Google Play requires that new apps target at least Android 9.0 (API level 28), and that app updates target Android 9.0 from November 1, 2019. Until these dates, new apps and app updates must target at least Android 8.0 (API level 26).

2. How to be upgraded to Target API 28

Simply put, modify the value of the compiled targetSdkVersion to 28

2.1 Android Studio and Gradle compilation projects

Generally in the build.gradle file in the App directory, modify the value of android->defaultConfig->targetSdkVersion to 28, such as:

2.2 Unity projects

In the Unity menu's File->Build Settings... pop-up window, select Android in Platform, and in Player Settings...

open the Inspector panel and find Other Settings->Target API Level and then make settings in it

2.3 UE4 Projects

Open the pop-up window in the UE4 menu's File->Package Project->Packaging Settings...,

and find the Platforms->Android configuration item and then modify the corresponding configuration

3. Configuration and processing

3.1 Network security processing

Android 9 already uses the encrypted network protocol (HTTPS) by default. For non-HTTPS requests, you need to add a configuration or a whitelist for network security processing

Note: When using Webview, you cannot open non-whitelisted HTTP websites.

Google upgrade instructions: https://developer.android.com/about/versions/pie/android-9.0-changes-28#tls-enabled

3.1.1 Add global configuration

If you use the global configuration, add the attribute android:usesCleartextTraffic="true" in the application node in AndroidManifest.xml:

3.1.2 Add a domain name whitelist

Configuration method:

  • In the application node in AndroidManifest.xml, add the android: networkSecurityConfig="@xml/network_security_config" attribute

xml   <?xml version="1.0" encoding="utf-8"?>   <manifest ... > <application android:networkSecurityConfig="@xml/network_security_config"... >         ...     </application>   </manifest>

  • Add the file res/xml/network_security_config.xml and configure the domain name information:

xml   <?xml version="1.0" encoding="utf-8"?>   <network-security-config>     <domain-config>         <domain includeSubdomains="true">pingma.qq.com</domain>         <domain includeSubdomains="true">182.254.116.117</domain>         <domain includeSubdomains="true">android.bugly.qq.com</domain>     </domain-config>   </network-security-config>

For more configuration information, please refer to: https://developer.android.com/training/articles/security-config.html

3.2 Apache HTTP library support

If the Apach HTTP library is used in your app, you need to add the following configuration under the application node in AnroidManifest.xml to ensure normal operation on Android 9

<uses-library android:name="org.apache.http.legacy" android:required="false" />

3.3 Webview multi-process data directory restrictions

Android 9 restricts Webview's directory access. MSDK uses a multi-process Webview to ensure that the memory is released normally. Games need to upgrade the Android Webview component:

  • 1.15.3 and above (games accessing WebView before mid-2017)
  • 2.2.8 and above version (games accessing WebView after mid-2017)

Note: Due to multi-process file directory restrictions, cookies and file data cannot be shared between Webviews

4. Component SDK upgrade

4.1 Beacon

  • Version requirements

The SDK version of Beacon needs to be >= 3.0.4

  • Upgrade method

- Replace the original plugin with the new version of plugin   - Unzip the jar package, and use the beaconcomp directory to replace the assets/beaconcomp directory file in the original project directory

4.2 PUSH

  • Version requirements

PUSH must be upgraded to Tencent Mobile Push TPNS version

  • Upgrade method   - Replace the original plugin with the new version of plugin

4.3 Bugly

  • Version requirements

It is recommended to upgrade Bugly to the latest version Java SDK 2.8.6, NDK 3.6.0

  • Upgrade method   - Replace the original plugin with the new version of plugin

4.4 TBS Webview

  • Version requirements   - The MSDK plugin must be upgraded to solve the multi-process data directory sharing problem   - TBS SDK can be supported and is not necessary to upgrade

  • Upgrade method   - Replace the original plugin with the new version of plugin

5. Precautions about upgrade

5.1 Environmental requirements

For Unity and UE4, please separately check whether Android SDK and build-tools directories have been correctly upgraded to the specified Target 28 version. The versions specified by MSDK are as follows:

compileSdkVersion: 28,
buildToolsVersion: '28.0.3',
minSdkVersion    : 15,
targetSdkVersion : 28,

Among them, buildToolsVersion has been upgraded to Target 28, the highest stable version.

MSDK permission list

Android

Channel Required permission Optional permission Purpose of use
MSDK 1、android.permission.INTERNET(network) 4、android.permission.WRITE_EXTERNAL_STORAGE(external storage) 1、Network communication
4、Write data to external storage for the persistence of program information and the storage of log files, sharing image and others; lack of this permission can affect the sharing function of externally stored images/videos
2、android.permission.ACCESS_NETWORK_STATE 5、android.permission.READ_EXTERNAL_STORAGE 2、Used for built-in WebView to get network status to sense network changes
5、Read data from external storagefor the persistence of program information and the storage of log files, sharing image and others; lack of this permission can affect the sharing function of externally stored images/videos
3、android.permission.CHANGE_NETWORK_STATE 6、android.permission.ACCESS_COARSE_LOCATION(rough location) 3、Operator password-free login authentication for built-in WebView(carrier number agreement
6、Provide LBS location information service to the game; the game can obtain the latitude and longitude as well as the information of nearby players through the interface, so that the player can interact with their surrounding players. If your game does not require the LBS function, you don't need to configure this permission
7、android.permission.ACCESS_FINE_LOCATION(precise location) 7、Provide LBS location information service to the game; the game can obtain the latitude and longitude as well as the information of nearby players through the interface, so that the player can interact with their surrounding players. If your game does not require the LBS function, you don't need to configure this permission
8、android.permission.CAMERA(camera) 8、Can visit the camera in the webpage. If your game doesn't require this function, you don't need to configure this permission
QQ 1、android.permission.INTERNET(network) 1、Network communication
2、android.permission.ACCESS_NETWORK_STATE(network state) 2、Sense network changes
WeChat - - -
Bugly 1、android.permission.INTERNET(network) 1、Network communication
2、android.permission.ACCESS_NETWORK_STATE(network state) 2、Sense network changes
QIMEI 1、android.permission.INTERNET(network) 1、Network communication
2、android.permission.ACCESS_NETWORK_STATE(network state) 2、Sense network changes
Beacon 1、android.permission.INTERNET(network) 1、Network communication,for data reporting
2、android.permission.ACCESS_NETWORK_STATE 2、Sense network changes,Used to adjust data reporting policies
3、android.permission.ACCESS_WIFI_STATE 3、Get Wifi status and information to adjust data reporting policy
TBS 1、View web link 2、clipboard 1、A network connection is required when opening web content through the SDK
2、The user actively operates the copy and paste of the content of the webpage or file
3、View geographic location 3、The user actively opens a third-party web page, and the web page itself needs to locate the location
TPNS 1、Application package name.permission.XGPUSH_RECEIVE(customize) 7、com.huawei.android.launcher.permission.CHANGE_BADGE(Huawei Custom Permissions) 1、Permissions pushed using TPNS
7、Permission to use Huawei device corner label function
2、android.permission.INTERNET 8、com.vivo.notification.permission.BADGE_ICON(Vivo custom permissions) 2、Allows programs to access network connections, possibly generating GPRS traffic
8、Permission to use vivo device corner label function
3、android.permission.ACCESS_WIFI_STATE 9、android.permission.VIBRATE 3、Allows the program to obtain the current Wi-Fi access status and information about WLAN hotspots
9、Allow app to vibrate
4、android.permission.ACCESS_NETWORK_STATE 10、android.permission.RECEIVE_USER_PRESENT 4、Allows programs to obtain network information status
10、Allows apps to receive screen-lit or unlocked broadcasts
5、android.permission.SCHEDULE_EXACT_ALARM 11、android.permission.WRITE_EXTERNAL_STORAGE 5、Allow scheduled broadcast
11、Allow programs to write to external storage
6、android.permission.WAKE_LOCK 12、android.permission.RESTART_PACKAGES 6、Allows background processes to run even after the phone's screen is turned off
12、Allow the program to end the task
13、android.permission.GET_TASKS 13、Allows programs to obtain task information

iOS

Channel Required permission Optional permission Purpose of use
MSDK 1、Network permissions 2、Location information 1、Network connection
2、Provide LBS location information service to the game; the game can obtain the latitude and longitude as well as the information of nearby players through the interface, so that the player can interact with their surrounding players. If your game does not require the LBS function, you don't need to configure this permission
3、Camera permissions 3、Can visit the camera in the webpage. If your game doesn't require this function, you don't need to configure this permission
4、User tracking (NSUserTrackingUsageDescription) 4、Get the IDFA of users of iOS14.5 and higher versions for data analysis and advertising purchase statistics
QQ 1、Network permissions 1、Network communication
WeChat - - -
Bugly 1、Network permissions 1、Network communication
QIMEI 1、Network permissions 1、Network communication
Beacon 1、Network permissions 1、Data reporting
TPNS 1、APNS (push) 1、Allow the program to use APNS services
2、Network permissions 2、Allow the program to connect

FAQ

font color="red">Matters needing attention:

MsdkActivity extends UnityPlayerActivity. After the game's main Activity extends MsdkActivity, it is not needed to call UnityPlayer's related functions in the life cycle again, such as onPause (), onResume (), etc., to avoid conflicts with MSDK, which may cause crash.

Instructions on the adaption of WeChat OpenSDK to iOS 15 system

For Apps compiled with Xcode13.0 and higher versions, the number of URL Scheme query is limited to 50 in iOS 15.0 and higher systems. For Apps with more than 50 schemes configured in LSApplicationQueriesSchemes in plist, they may cause:

  1. Some interfaces of WeChat OpenSDK return wrong results;
  2. Unable to use Universal Link to initiate WeChat, causing the problem that App's name is added with "Unverified Application" after messages are shared to WeChat.

Developers who use Xcode 13.0 and above versions to compile App need to adapt to iOS 15 to ensure the normal use of WeChat OpenSDK.

Background

Starting from iOS 9, iOS has supported configuring LSApplicationQueriesSchemes in the project's plist.

After configuring the scheme of other Apps in LSApplicationQueriesScheme, you can use the following code to judge whether or not to skip to the corresponding App through scheme.

 BOOL ret = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weixin://"]];

When WeChat OpenSDK is accessed,WeChat Access Documentation requires to add "weixin" and "weixinULAPI" in LSApplicationQueriesScheme.

iOS 15 system-related changes

Confirmed with Apple, **On iOS 15 system, for Apps compiled with Xcode 13, the number ofLSApplicationQueriesSchemes shall be limited to 50.

The scheme configuration after the 50th scheme will not take effect. The following code will return NO

BOOL ret = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"otherAppScheme://"]]; 

Suggestions on adaptation to WeChat OpenSDK

If the number of schemes configured in LSApplicationQueriesSchemes is less than 50 or the two schemes, "weixin" and "weixinULAPI", are in the first 50 ones, it is not needed to adapt to WeChat OpenSDK.

Apps compiled with Xcode 12 and lower versions currently do not need to adapt to WeChat OpenSDK.

Make sure that "weixin" and "weixinULAPI" are configured in the first 50 of LSApplicationQueriesSchemes. Otherwise, the following interfaces may return incorrect results or behave abnormally in the iOS 15 system:

  1. [WXApi isWXAppInstalled]:it will also return "NO" if WeChat is installed
  2. [WXApi isWXAppSupportApi]:it will also return "NO" if it is supported
  3. [WXApi isWXAppSupportStateAPI]:it will also return "NO" if it is supported
  4. [WXApi sendAuthReq:viewController:delegatecompletion]:it will judge whether WeChat is installed and will then initiate the webpage authorization.
  5. All interfaces will not be able to use Universal Link to initiate WeChat and will use scheme to initiate WeChat in a downgrading manner, resulting in the "Unverified Application" problem