This is the first day of my participation in the Gwen Challenge in November. Check out the details: the last Gwen Challenge in 2021

preface

I wonder if you’ve had a good week?

I’ve had a crazy week. Why?

The Personal Information Protection Law of the People’s Republic of China will take effect on November 1, 2021. Apple’s father also remembered to send me an email to express his kind regards.

In the mind do not know how many grass mud horse roaring past.

Today, I will talk about the rectification of gaode Map.

Amap rectification

Because the company’s project is very old, Amap has not been upgraded. This time, it is clearly required that the map package should be upgraded to 8.1.0 to avoid rejection due to personal privacy and other issues.

pod 'AMap3DMap'
pod 'AMapSearch'
pod 'AMapLocation'
pod 'AMapNavi'
Copy the code

In the previous project, there was such integration, I directly specified the version after the POD update, directly reported an error, later found analysis:

The new version of AMapNavi contains the libraries in AMap3DMap. Integrating both of them at the same time will cause problems.

Pod 'AMapSearch' pod 'AMapLocation', '~> 2.8.0' pod 'AMapNavi', '~> 8.0.1'Copy the code

Then update the repo from the command line:

pod repo update
Copy the code

Then upgrade the library at the directivity:

pod install --verbose --no-repo-update
Copy the code

After the upgrade is completed, some API may be changed or abandoned. You can fix it one by one according to the AMap API documentation.

Then you’ll find new apis in the new SDK:

  • AMapLocationManager:

  • AMapSearchAPI:


The key is the following code, which should be called before the map-related service is initialized:

Before constructing AMapLocationManager, you need to display user authorization popup, including Autonavi SDK privacy protocol and after authorizing autonavi SDK privacy protocol, Can be normal use function [AMapLocationManager updatePrivacyShow: AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; [AMapLocationManager updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; /// The user authorization popup should be displayed before the construction of AMapSearchAPI, including the Autonavi SDK privacy protocol and after the authorization of the AUtonavi SDK privacy protocol, the map function can be used normally. Otherwise AMapSearchAPI structure failure returns nil [AMapSearchAPI updatePrivacyShow: AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; [AMapSearchAPI updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree];Copy the code

Scott location services and search services I was in – (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) called and completed in the launchOptions method.

Copy and paste the above code block directly! Copy and paste! Copy and paste!

Important things say three times! The change in the transmission caused autonavi’s service to fail. I’ve already been to the pit.

It should be noted that the official link of Amap is obviously to jump to iOS, but the result is still related to Android. In addition, the official document does not say too much about API call methods.

Reference documentation

Important: SDK compliance usage plan

Note to Developers

iOS_Map_Doc/AMap_iOS_API_Doc_3D

conclusion

In short, the first thing to do at present is to upgrade autonavi SDK, do a good job of API call, review waiting for the shelves.

If Apple reports a problem, continue to rectify it.