Ich mache eine App, in der ich den aktuellen Standort des Benutzers finden muss. Kann ich den aktuellen Standort des Benutzers im iOS 5 Simulator mit CLLocationmanager abrufen? Schema bearbeiten - -Aktueller Standort im Simulator
6
A
Antwort
8
Xcode Lauf you.app - Option
Prüfung zulassen Standort Simulation, dann wählen Sie "Default Location"
Add GPX File to Project
das Format like this
-4
- (void)viewDidLoad{
[super viewDidLoad];
self.title = @"MapView";
self.navigationController.navigationBarHidden = NO;
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];
}
- (void) loadPin {
iCodeBlogAnnotation *appleStore1;
CLLocationCoordinate2D workingCoordinate;
workingCoordinate.latitude = [latitude doubleValue];
workingCoordinate.longitude = [longitude doubleValue];
appleStore1 = [[iCodeBlogAnnotation alloc] initWithCoordinate:workingCoordinate];
[appleStore1 setTitle:[NSString stringWithFormat:@"Default Point"]];
//[appleStore1 setSubtitle:[NSString stringWithFormat:@"Distance %.2f Miles",miles]];
[appleStore1 setAnnotationType:iCodeBlogAnnotationTypeEDU];
[mapView addAnnotation:appleStore1];
[(MKMapView*)self.mapView selectAnnotation:appleStore1 animated:NO];
MKCoordinateRegion region;
region.center.latitude = [latitude doubleValue];
region.center.longitude = [longitude doubleValue];
region.span.latitudeDelta = .5;
region.span.longitudeDelta = .5;
[mapView setRegion:region animated:YES];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
latitude = [[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.latitude];
longitude = [[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.longitude];
[locationManager stopUpdatingLocation];
if (latitude > 0) {
[self loadPin];
}
}
7
In Xcode, Sie können den zu simulierenden Ort mit einem kleinen Knopf über der Konsole auswählen.
Verwandte Themen
- 1. aktueller Standort mit Android
- 2. ASP .net aktueller physischer Standort
- 3. Ist die Schaltfläche "Aktueller Standort/Kompass" im iOS-SDK verfügbar?
- 4. blackberry simulator "fileconn.dir.fotos" standort?
- 5. Google Maps Android API und aktueller Standort
- 6. Aktueller Standort wird unter falschen Bildschirmkoordinaten angezeigt
- 7. Aktueller Standort Button auf ios MKMapView
- 8. Mit Core-Standort auf iPhone-Simulator
- 9. Django, Aktueller Monat im Abfragesatz
- 10. Aktueller Standort mit benutzerdefinierter Annotation, Call-Out und blauem Genauigkeitskreis
- 11. iOS9 Tracking-Standort nicht während im Hintergrund
- 12. Download App im Simulator
- 13. cell.accessoryType im Simulator 3.0?
- 14. Befehlstaste im iOS-Simulator
- 15. Legen Sie den Standort in iPhone Simulator fest
- 16. Standort Update im Service
- 17. iOS-Simulator setzt den Standort immer auf "Keine" zurück
- 18. Mein einfaches Kartenprojekt wird nicht angezeigt und zeigt meinen Standort im Simulator
- 19. Standort-Simulator City/GPX während der Laufzeit festlegen
- 20. Aktivierung der Bildschirmtastatur im Simulator
- 21. Audio nicht im Simulator spielen
- 22. Flugzeugmodus im iPhone Simulator simulieren
- 23. Neu im Netzwerk Simulator 3
- 24. iPhone Retina-Display im Simulator
- 25. Inkonsistente Ergebnisse im Simulator (iOS)?
- 26. google-services.json Standort im Projektbaum
- 27. Aktueller Zeitstempel
- 28. Mein aktueller Standort gibt immer null zurück. Wie kann ich das beheben?
- 29. Karte öffnen URL im iPhone Simulator leitet immer um
- 30. Aktueller Artikel ViewPageAdapter Android
Hoffe, Sie haben nichts dagegen, ich Ihre Antwort ein bisschen formatiert. Aber nach dem zweiten Blick auf deine Antwort: Bist du sicher, dass dies mit OPs Frage zusammenhängt? –