Last time used a Baidu map, has not taken notes, today remember a pen.
Previously did not use Baidu map when, listen to do this aspect of the friend said Baidu Map has a lot of pits, but I do not encounter too big pit, mainly to pay attention to official documents, there are various options in the development of configuration environment.
Also do not know what is the reason, in the configuration of the Plist file when the first demo when the configuration is very successful, but in the actual project does not know why there is no configuration, redo a few times did not do a good job here, the pits compared to hit it, Finally, the successful configuration of the plist file replaced the actual project plist and then the app name and bundle ID and other fields replaced, and finally succeeded. The next look is because the following item is not configured, is to be in the first configuration of the dictionary to add nsallowsarbitraryloads This option and I was loaded outside this layer so there is a problem.
Because the iOS9 switch to more secure HTTPS, in order to be able to use the Map SDK in IOS9, please configure the following in "Info.plist", otherwise affect the use of the SDK.
<key>nsapptransportsecurity</key> <dict<key> Nsallowsarbitraryloads</key<true</dict>
Here's a look at the basic map:
-(void) viewdidload { [super viewdidload]; Do any additional setup after loading the view. _mapview = [[Bmkmapview alloc]initwithframe:cgrectmake (0, 0, kwidth, kheigth)];// bmkmaptypenone = 0,/// < blank map// Bmkmaptypestandard = 1, ///< standard map// Bmkmaptypesatellite = 2, ///< satellite map [_mapview Setmaptype:bmkmaptypestandard]; Open the Live traffic layer// [_mapview Settrafficenabled:yes]; Close the live traffic layer// [_mapview settrafficenabled:no]; Open Baidu City Thermal graph layer (Baidu own data) [_mapview Setbaiduheatmapenabled:yes]; Close Baidu City Thermal graph layer (Baidu own data)// [_mapview setbaiduheatmapenabled:no]; [Self.view Addsubview:_mapview];}
The use of basic maps is actually some basic configuration of the map, according to their own needs to configure the line.
The following are the use of system pins:
-(void) Viewdidappear: (BOOL) Animated {//Add a pointannotation Bmkpointannota tion* annotation = [[Bmkpointannotation alloc]init]; Cllocationcoordinate2d coor; Coor.latitude = 39.915; Coor.longitude = 116.404; Annotation.coordinate = coor; Annotation.title = @ "Here is Beijing"; [_mapview addannotation:annotation];} -(Bmkannotationview *) Mapview: (Bmkmapview *) Mapview viewforannotation: (ID <BMKAnnotation>) annotation{// Do not label the method//if (annotation! = nil) {//[_mapview removeannotation:annotation];//} if ([Annotation i Skindofclass:[bmkpointannotation class]] {Bmkpinannotationview *newannotationview = [[Bmkpinannotationview alloc] Initwithannotation:annotation reuseidentifier:@ "Myannotation"]; Newannotationview.pincolor = Bmkpinannotationcolorpurple; Newannotationview.animatesdrop = yes;//Set the callout point animation to show return Newannotationview; } return nil;}
The use of a system pin is simple, and I'll talk about a custom pin later.
Ios_sn_ Baidu Map Basic use (1)