05/15/2024 15:19:45

Problem description

Common problems related to WebView JS as well as troubleshooting process

Causes of the problem

Consulting

Solution

1. The system version and kernel version where problems occur

The JS function depends on the client-side web kernel. When a problem occurs, it is needed to identify the system version (iOS) and kernel version (Android) of the device with the problem as soon as possible. iOS relies on the system's Webkit kernel and uses Apple's native WKWebView (MSDK versions earlier than MSDK 3.3.9i/MSDK 5.7.001 might use UIWebView), and Android depends on TBS kernel.

The method for checking TBS WebView version and the kernel's type and version number (this method is provided by TBS staff and may be changed in the future): Open the link, debugtbs.qq.com, through the built-in WebView to check them. When the kernel's version number is displayed as "0", this means that the kernel is the system kernel.

Image description

2. Clarify the type of problems

JS problems are generally divided into two types: UI problems and functional problems.

1) UI problems (relatively few; generally need to contact MSDK Assistant to identify them)

WebView UI display exceptions, such as the abnormal display of upper status bar or lower toolbar of MSDK WebView,as well as the abnormal position of WebView's toolbar or status bar after the rotation of the screen. However, it should be noted that the abnormal display of UI inside the activity page is not within MSDK's processing scope and needs to be adapted by the staff who develop the activity page.

2) Functional problems (relatively abundant; usually solved by the page development staff through adapting the page)

Common functional problems include JS invocation sharing exceptions, JS invocation login exceptions ( JS invocation login is not MSDK's capability), and the failure of the pseudo link to launch APP.

3. Common JS functional problems

1) Some button in JS do not respond to clicks (such as invoking system interfaces or loading some specific tags)

It is necessary to confirm whether the corresponding version of the kernel supports these APIs. Generally, if you use the Andorid TBS kernel, you can contact X5Helper to assist in locate the problems. If you use the iOS WebKit kernel and the Android system kernel, you can search for information about their support for the JS API via Google by yourself.

2) Some button in JS do not respond to clicks (such as invoking JS API provided by MSDK)

The verification method for judging whether the function is normal: You can place the MSDK JS Demo link below into the built-in WebView of the game to actually test whether the relevant functions are normal. If the JS Demo works normally, you need to check the reasons on the page side, because the functions of MSDK are normal.

V5 JS Demo link: https://img.ssl.msdk.qq.com/msdk_client_test/MSDKWebViewDemo.html

V3 JS Demo link: https://img.msdk.qq.com/wiki/msdkjs.html

If the JS Demo is not easy to use, you can refer to the processing methods in the following table:

MSDK Version Operation Platform Solution
V5 Android Refer to the method shown in Get MSDK log to get the MSDK log at the time of reproduction, and analyze the specific causes of the specific problems through the error message.
V5 iOS You can invoke related API with about 1s of delay for testing again and see the test result. The JS functions of iOS depend on a bridge, called JSBridge, established between the page and the client. If the API is invoked too fast, the bridge may not be established yet.
V3 Double-ended 1. You can try to delete all JS dependencies except MSDK JS dependencies and then test related functions.
2. Get the MSDK log in the Debug environment and analyze the causes of the specific problems.

3) Page slide sticking or other UI display problems in the page

The page side needs to adapt itself or contact the WebView kernel side for help. MSDKWebView does not control the actual content displayed on the page.

4) Unexpected pop-ups in the page

MSDKWebView does not contain all kinds of pop-up UI. The page side needs to check the source of the pop-ups by itself.

5) A request on the iOS page does not return any request result, and there is an error message in the log: Error Domain=NSURLErrorDomain Code=-999

Cause of the problem: The system error description corresponding to -999 is Cancelled. The reason is that the game initiated a second request before the previous asynchronous request was loaded, and Webkit judged that the previous request was canceled and then returned it directly to MSDK, causing the subsequent request to be terminated.
Solution: This problem only occurs in the old versions of MSDK, such as V3. MSDK has protected here since MSDK 3.3.23i.

(1) It is necessary to open the same pseudo link through the same recurring path in the system WebView or QQ WebView. If the pseudo link cannot launch other APPs in other WebViews, you need to contact the pseudo link provider to confirm the validity of the pseudo link;
(2) For problems occurring on the iOS side only, you can see whether the LSApplicationQueriesSchemes field in the info.plist file of the game's XCode project has configured a whitelist of target APPs. The iOS system stipulates that the corresponding APPs cannot be launched if a whitelist of such APPs is not configured;
(3) It is necessary to confirm with the target APP whether to prevent it from being evoked by technical means, so as to prevent the capability from being maliciously used.

7) The page cannot get the in-game login status

MSDK transmits the login status information to the activity page by adding the encrypted login status parameter behind the URL of the activity page opened by the game client. The parameter name added in V5 is: itopencodeparam, and in V3: msdkEncodeParam. The page side can obtain the encrypted login status by itself, and decrypt the login status through V5 decryption interface or V3 decryption interface provided by MSDK.
This capability is the default capability of MSDK's OpenUrl interface, but the client configuration provided by MSDK V5 is allowed not to add the encrypted login status. The activity page developer must confirm with the game client developer whether there is any relevant configuration. For details, please refer to: V5 WebView

Image description

8) How can the page side judge whether what the game client accesses is MSDK V3 or V5?

The MSDK side does not provide any relevant interface for such judgment. It is not recommended that the game use User-Agent and other methods as the basis for such judgment. The activity page developer needs to make such judgment on its own.



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""