Ich habe Probleme, C-struct zu NSDictionary hinzuzufügen.
Die C-Struktur ist MKCoordinateRegion auf MapKit.h.obj-c füge c-struct zum Dictionary hinzu
Diese Erklärung ist
typedef struct {
CLLocationCoordinate2D center;
MKCoordinateSpan span;
} MKCoordinateRegion;
und CLLocationCoordinate2D Erklärung ist
typedef struct {
CLLocationDegrees latitude;
CLLocationDegrees longitude;
} CLLocationCoordinate2D;
MKCoordinateSpan gleich ist.
Jetzt möchte ich die MKCoordinateRegion zu NSDictionary hinzufügen.
CLLocationCoordinate2D center = CLLocationCoordinate2DMake(40.723128, -74.000694);
MKCoordinateSpan span = MKCoordinateSpanMake(1.0, 1.0);
MKCoordinateRegion region = MKCoordinateRegionMake(center, span);
NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
[param setObject:region forKey:@"region"];
5 Zeile hat Fehler.
Fehlermeldung "Senden 'MKCoordinateRegion' zu Parameter des inkompatiblen Typs 'ID'"
Vielen Dank.
Siehe die nicht akzeptierte Antwort [hier] (http://stackoverflow.com/questions/6538726/how-to-return-multiple-values-from-a-method/6539044 # 6539044). Das Beispiel bezieht sich auf Arrays, aber dasselbe gilt auch für Wörterbücher. – Joe