ios location tracking basic
TRANSCRIPT
![Page 1: iOS Location Tracking Basic](https://reader037.vdocuments.mx/reader037/viewer/2022103018/55a685ee1a28abe7088b4625/html5/thumbnails/1.jpg)
iOS App Development
Q.1 Tracking Locationhttp://iosappdev.co.kr
13년 2월 28일 목
![Page 2: iOS Location Tracking Basic](https://reader037.vdocuments.mx/reader037/viewer/2022103018/55a685ee1a28abe7088b4625/html5/thumbnails/2.jpg)
CLLocationManager
Core Location Framework
<CoreLocation/CoreLocation.h>
Interface for delivering Location Update
13년 2월 28일 목
![Page 3: iOS Location Tracking Basic](https://reader037.vdocuments.mx/reader037/viewer/2022103018/55a685ee1a28abe7088b4625/html5/thumbnails/3.jpg)
CLLocationManagerSteps to use: Simplest Example
Instantiate - [[... alloc] init];
Setup desiredAccuracy @property
Implement and Assign a Delegate
delegate @property
CLLocationManagerDelegate
[... startUpdatingLocation]
Receive Update: CLLocation object
13년 2월 28일 목
![Page 4: iOS Location Tracking Basic](https://reader037.vdocuments.mx/reader037/viewer/2022103018/55a685ee1a28abe7088b4625/html5/thumbnails/4.jpg)
CLLocationManagerInitialize and Start Updating
@interface ......@property (nonatomic, strong) CLLocationManager *locationManager;...@end// in a method // Instantiate
self.locationManager = [[CLLocationManager alloc] init]; // Setup Delegate: See Next Slide self.locationManager.delegate = self; // Setup Accuracy CLLocationAccuracy accuracy = kCLLocationAccuracyNearestTenMeters; self.locationManager.desiredAccuracy = accuracy; // Start! [self.locationManager startUpdatingLocation];...
13년 2월 28일 목
![Page 5: iOS Location Tracking Basic](https://reader037.vdocuments.mx/reader037/viewer/2022103018/55a685ee1a28abe7088b4625/html5/thumbnails/5.jpg)
CLLocationManagerSetup a Delegate
@interface KMUViewController () <CLLocationManagerDelegate>......@end// in a method, before starting update ... self.locationManager.delegate = self;...
#pragma mark - CLLocationManagerDelegate- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{ CLLocation *location = [locations lastObject]; CLLocationDegrees lat = location.coordinate.latitude; CLLocationDegrees lon = location.coordinate.longitude; // ... self.textField.text = [location description];}
13년 2월 28일 목
![Page 6: iOS Location Tracking Basic](https://reader037.vdocuments.mx/reader037/viewer/2022103018/55a685ee1a28abe7088b4625/html5/thumbnails/6.jpg)
Demo
/ Demos / Day2 / Demo / Location /
https://github.com/iosappdev/KMU2013
13년 2월 28일 목
![Page 7: iOS Location Tracking Basic](https://reader037.vdocuments.mx/reader037/viewer/2022103018/55a685ee1a28abe7088b4625/html5/thumbnails/7.jpg)
Testing in Simulator
http://iosappdev.co.kr
13년 2월 28일 목