Parcourir la source

1.修改iOS Apex Mobile屏蔽地图Fake数据。

Pen Li il y a 8 ans
Parent
commit
cb8b2ef603

+ 1 - 1
Apex Mobile/Apex Mobile/HomeViewController.m

@@ -837,7 +837,7 @@ typedef enum {
     
     NSDictionary *item = [self.shipArray objectAtIndex:indexPath.section];
     NSDictionary *locationInfo = [item objectForKey:@"locations"];
-    locationInfo = [self fakeLoaction];
+//    locationInfo = [self fakeLoaction];
     
     [self.mapView showShipAnnotaion:locationInfo];
     

+ 22 - 15
Apex Mobile/Apex Mobile/ShipMap/AMShipMap.m

@@ -43,21 +43,28 @@ typedef enum {
     }
     NSString* addr = [location valueForKey:@"addr"];
     NSString* name = [location valueForKey:@"name"];
-    double longitude = [[location valueForKey:@"lon"] doubleValue];
-    double latitude = [[location valueForKey:@"lat"] doubleValue];
-    
-    // 创建大头针(标注)的数据模型(此处不创建视图,视图通过MKMapView的委托设置回调方法来生成的)
-    AMShipAnnotation *ann = [[AMShipAnnotation alloc] init];
-    CLLocationCoordinate2D c2d = CLLocationCoordinate2DMake(latitude, longitude);
-    // 指定大头针的经纬度坐标(位置)以及附加的信息
-    ann.coordinate = c2d;
-    ann.title = name;
-    ann.subtitle = addr;
-    ann.priority = priority;
-    
-    // 将大头针数据模型添加到MKMapView上管理
-    [self.mapView addAnnotation:ann];
-    
+    NSString *lonStr = [location valueForKey:@"lon"];
+    NSString *latStr = [location valueForKey:@"lat"];
+    if (lonStr && lonStr.length > 0 && latStr && latStr.length > 0) {
+        
+        double longitude = [lonStr doubleValue];
+        double latitude = [latStr doubleValue];
+        
+        // 创建大头针(标注)的数据模型(此处不创建视图,视图通过MKMapView的委托设置回调方法来生成的)
+        AMShipAnnotation *ann = [[AMShipAnnotation alloc] init];
+        CLLocationCoordinate2D c2d = CLLocationCoordinate2DMake(latitude, longitude);
+        // 指定大头针的经纬度坐标(位置)以及附加的信息
+        ann.coordinate = c2d;
+        ann.title = name;
+        ann.subtitle = addr;
+        ann.priority = priority;
+        
+        // 将大头针数据模型添加到MKMapView上管理
+        [self.mapView addAnnotation:ann];
+        
+    } else {
+        return;
+    }
 }
 
 - (void)showShipAnnotaion:(NSDictionary *)annotation {