Sorry the above is nonsense. ## ##I tested your code and I can draw a line on my device, from
Tiangong Manor, Yinzhou District, Ningbo City, Zhejiang Provinceto
Liangzhu Cultural Park, Yinzhou District, Ningbo City, Zhejiang Province, it is recommended that you add a log or breakpoint in the drawPlacemark1 method to check whether the CLPlacemark returns correctly. Poor network conditions will cause this situation, and you should handle it accordingly, that is, you should check whether NSError has a value and handle it accordingly. . ##
[geocoder geocodeAddressString:@"Butterfly Lovers Cultural Park" completionHandler:^(NSArrayplacemarks, NSErrorerror) {
}];
Should the
placemark2
andplacemark1
pointers be exchanged during the traversal process?placemark2
和placemark1
指针。抱歉上面是瞎说的。
我测了你的代码,在我的设备上可以画出线路,从
Sorry the above is nonsense. ## ##I tested your code and I can draw a line on my device, from浙江省宁波市鄞州区天宫庄园
到浙江省宁波市鄞州区梁祝文化公园
Tiangong Manor, Yinzhou District, Ningbo City, Zhejiang Province
toLiangzhu Cultural Park, Yinzhou District, Ningbo City, Zhejiang Province
, it is recommended that you add a log or breakpoint in the drawPlacemark1 method to check whether the CLPlacemark returns correctly. Poor network conditions will cause this situation, and you should handle it accordingly, that is, you should check whether NSError has a value and handle it accordingly. . ##