[BMKGradient generateColorMap:resultColorMap:]: unrecognized selector sent to instance 0x7fae64f32260

[BMKGradient generateColorMap:resultColorMap:]: unrecognized selector sent to instance 0x7fae64f32260

如题,这么恶心的一个问题,找了好久,百度上也找不到相关答案,最后还是问Google问出来的!

解决方案是在Build Settings–Linking–[Other Linker Flags]中添加一个“-ObjC”,即可搞定!

附加百度添加热力图的demo方法:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
BMKHeatMap* heatMap = [[BMKHeatMap alloc] init];
NSMutableArray* data = [NSMutableArray array];
int num = 1000;
for(int i = 0; i<num; i++)
{
????//创建BMKHeatMapNode
????BMKHeatMapNode* heapmapnode_test = [[BMKHeatMapNode alloc] init];
????//此处示例为随机生成的坐标点序列,开发者使用自有数据即可
????CLLocationCoordinate2D coor;
????float random = (arc4random()%1000)*0.001;
????float random2 = (arc4random()%1000)*0.003;
????float random3 = (arc4random()%1000)*0.015;
????float random4 = (arc4random()%1000)*0.016;
????if(i%2==0){
????????coor.latitude = 39.915+random;
????????coor.longitude = 116.403+random2;
????}else{
????????coor.latitude = 39.915-random3;
????????coor.longitude = 116.403-random4;
????}
????heapmapnode_test.pt = coor;
????//随机生成点强度
????heapmapnode_test.intensity = arc4random()*900;
????//添加BMKHeatMapNode到数组
????[data addObject:heapmapnode_test];
}
//将点数据赋值到热力图数据类
heatMap.mData = data;
//调用mapView中的方法根据热力图数据添加热力图
[self.mapView addHeatMap:heatMap];

Leave a Reply