3
私は基本的にXMLを返すリモートWebサービスに接続しています。私はその後、そのXMLをPropertyオブジェクトに解析しています(実際の状態のようなものだと思います)。複数のアドレスを順方向ジオコーディングで発行する
しかし、Webサービスは各プロパティだけの郵便番号を返します。注釈を地図に配置するために必要な座標は提供されません。私は、郵便番号を提供している住所を地理コードすることができます。しかし、私の問題は、それは私が複数の要求
を行うことを許可されていませんここで、それはちょうど1つのプロパティをジオコーディングだ何らかの理由で私のコード
- (void)processProperties:(Property *)property {
[geocoder geocodeAddressString:property.postalCode
completionHandler:^(NSArray* placemarks, NSError* error){
placemark = [placemarks lastObject];
for (CLPlacemark* aPlacemark in placemarks)
{
[sublet setLatitude:aPlacemark.location.coordinate.latitude];
[sublet setLongitude:aPlacemark.location.coordinate.longitude];
}
}];
}
- (void)addAnnotations:(NSArray *)objects {
CLLocationDegrees lat;
CLLocationDegrees longitude;
CLLocationCoordinate2D mCoords;
NSString *fullAddress;
// Add the annotations found nearby
for (Property *property in objects) {
[self processProperties:property];
lat = property.latitude;
longitude = property.longitude;
fullAddress = [NSString stringWithFormat:@"%@ %@ %@", property.houseNumber, @" ", property.streetName];
[self createAnnotationWithCoords:mCoords :fullAddress :[NSString stringWithFormat:@"$%.2f", property.rent]];
}
zoomLevel = 0.1;
mCoords = CLLocationCoordinate2DMake(lat,longitude);
MKCoordinateRegion region = MKCoordinateRegionMake(mCoords,MKCoordinateSpanMake(zoomLevel,zoomLevel));
[self.mapView setRegion:region animated:YES];
}
ですされています。それに応じてループを通過していない。
アイデアの皆様?
アップルは、アプリケーションセッションごとに1つのジオコーディングしか実行しないことを推奨しているようですが、これは非常に限定的です。あなたはインスタンス1コールだけを許可することでこれを強制しているようです。複数のインスタンスを作成することで問題は解決しますが、実行する必要があることは確かに奇妙なことです。 – akaru