今是昨非

今是昨非

日出江花红胜火,春来江水绿如蓝

MapManagerSDK integration record

Background#

Recently, I integrated the MapManager SDK and encountered several issues. Here, I will record them:

Issue 1:

The integration method for importing the GMObjC algorithm SDK, as mentioned in the integration document, is as follows. After importing, it fails to compile and shows the error: "sm2_plaintext_size" Too many arguments to function call, expected 3, have 4

pod 'GMObjC','3.0.0'

Issue 2:

After importing MapManager, QMUI library or other third-party libraries that were previously working fine now show compile errors.

Issue 3:

After solving the above issues and successfully compiling, the application crashes immediately upon launch.

Solution:#

The solution for Issue 1, "sm2_plaintext_size" Too many arguments to function call, expected 3, have 4, is simple. Change it to pod 'GMObjC' and install the latest version.

For Issue 2, upon investigation, it was found that the error occurred in places where debug or release variables were defined in properties or methods. But why didn't it cause any issues before? After careful examination, it was discovered that in the MapManager SDK, in the MapService.h class, the following code exists:


#define debug @"debug"
#define release @"release"

The macros defined here do not have a prefix to differentiate them, causing errors in other parts of the project where debug or release is used. To solve this, modify the code as follows. PS: When encapsulating third-party SDKs, if macros need to be exposed for external use, they must be handled properly.


#define kDebugStr @"debug"
#define kReleaseStr @"release"

Finally, for Issue 3, after solving the previous issues and successfully compiling, the application crashes immediately upon launch, indicating a memory leak. After a long investigation, it was initially thought that some dependency libraries were not imported. However, after comparing with the tutorial, it was found that no third-party libraries were missing. Later, it was suspected that there was an issue with MapManager, so MapManager was removed and only GMObjC was kept. However, the application still crashed upon launch. So, I checked the Github page of GMObjC and found the following statement:

GMObjC relies on OpenSSL 1.1.1 and above. CocoaPods does not support different versions of the same static library. If you encounter OpenSSL conflicts with third-party libraries, for example, Baidu MapKit depends on a lower version of the OpenSSL static library, a dependency conflict will occur.

This means that GMObjC depends on OpenSSL, and some third-party SDKs may also depend on it, causing conflicts, such as with the Baidu Map SDK. Coincidentally, my project also uses the Baidu Map SDK. Could this be the issue? Although conflicts usually result in compile errors, what if it's not the case? So, I changed the way GMObjC is imported from Pod to Carthage, and after compiling and running, it worked... Indeed, it was a conflict with Baidu Map. What a pitfall...

Then, I integrated MapManager back and remembered to make the modification for Issue 2... After compiling and running, it worked fine.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.