Notes for Using iOS Baidu Map
Step 1: Introduce BaiduMapAPI. framework
Step 2 introduce the required system library
CoreLocation. framework, QuartzCore. framework, OpenGLES. framework, SystemConfiguration. framework, CoreGraphics. framework, and Security. framework are introduced in the Xcode project. Add the frameworks in Xcode Project> Active Target> Build Phases> Link Binary With Libraries.
Step 3: configure the environment
Add-ObjC to TARGETS-> Build Settings-> Other Linker Flags.
Step 4: Introduce the mapapi. bundle resource file
If you use the basic map function, you need to add the resource. Otherwise, the map cannot be displayed normally.
Mapapi. bundle stores resource images for locating, marking View and route key points by default, and also stores necessary resource files for vector map rendering. If you do not need the built-in image display function, you can delete the image folder in the bundle file. You can also replace or delete the image files in the image folder of the bundle as needed.
Method: select the project name, right-click the project name, and choose Add Files to "project name "..., Select the mapapi. bundle file from the BaiduMapAPI. framework | Resources file, select the Copy items if needed check box, and click the Add button to Add the resource file to the project.
Step 5 introduce the header file
Introduce the header file in the SDK class:
# Import
// Introduce all header files # import
// Only introduce a single header file.
The content in the Baidu map document is referenced above. Note the fourth article, which exists in the. framework, but must be added to the project separately.
You also need to add it in info. plist (either of the following two is selected, and NSLocationWhenInUseUsageDescription is used by default ):
NSLocationWhenInUseUsageDescription, which allows you to obtain the GPS description during foreground use.
NSLocationAlwaysUsageDescription, which allows permanent use of GPS description
The engine initialization fails due to the absence of step 1 during use. It is inconvenient to write Baidu documents. I wrote this article to help my friends who will use Baidu map.