[英]Some pins sometimes don't show up on MKMapView… WHY?
因此,我有以下代碼,該代碼將街道,城鎮,州,國家/地區,郵政編碼分開,並創建一個AddressAnnotation,這是我從注解擴展的一個類。
有時所有的圖釘都顯示在地圖上,有時它找不到某些地方,盡管它每次都是完全相同的地址的集合。 有什么理由使Google地圖有時但並非始終都能找到位置?
我的代碼中有東西嗎?
謝謝,R
for (int i=0; i < [places count]-1; ++i) {
NSArray *arrayPlace = [[places objectAtIndex:i] componentsSeparatedByString:@"***"];
AddressAnnotation *addAnnotation = [[AddressAnnotation alloc] initWithCoordinate:
[self getLocationFromAddressString:
[NSString stringWithFormat:
@"%@ %@ %@ %@ %@ %@",
[arrayPlace objectAtIndex:3],
[arrayPlace objectAtIndex:4],
[arrayPlace objectAtIndex:5],
[arrayPlace objectAtIndex:6],
[arrayPlace objectAtIndex:7],
[arrayPlace objectAtIndex:8]]]];
[addAnnotation setWebsite:[arrayPlace objectAtIndex:2]];
[addAnnotation setTitle:[arrayPlace objectAtIndex:0]];
[addAnnotation setSubtitle:[arrayPlace objectAtIndex:1]];
[mapView addAnnotation:addAnnotation];
}
它不應該在第一行中出現嗎?
for (int i=0; i < [places count]; i++) {
或者更好:
for (NSArray *arrayPlace in places) {
嘗試記錄正在生成的地址字符串。 如果它們始終相同,則查看getLocationFromAddressString並查看其返回的坐標是否始終相同。 如果不是,則該功能有問題。 我一直在尋找該功能,但是Google一直讓我回到StackOverflow。 是您自己的功能,還是您已使用此問題中的功能? MKMapView與地址
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.