Trazar una ruta de usuarios tomada en un mapa usando MKPolyline

Soy bastante nuevo en Objective-c.

En mi aplicación, estoy tratando de trazar la ruta tomada por los usuarios en un mapa.

Aquí está lo que tengo hasta ahora que solo obtiene la ubicación actual de los usuarios:

#import "StartCycleViewController.h"
#import "CrumbPath.h"


@interface StartCycleViewController ()

@property (nonatomic, strong) CLLocationManager *locationManager;

@property (nonatomic, strong) IBOutlet MKMapView *map;

@property (nonatomic, strong) UIView *containerView;





@end

@implementation StartCycleViewController

@synthesize cycleLocation = _cycleLocation;
@synthesize currentCycleLocation = _currentCycleLocation;






 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
 {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    // Custom initialization
    }
    return self;
 }

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self startCycleLocation];

    _containerView = [[UIView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:self.containerView];

    [self.containerView addSubview:self.map];
    // Do any additional setup after loading the view.
}


- (void)dealloc
{
    self.locationManager.delegate = nil;
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - startCycleLocation

- (void)startCycleLocation{

    if (!_cycleLocation){
        _cycleLocation = [[CLLocationManager alloc]init];
        _cycleLocation.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
        _cycleLocation.distanceFilter = 10;
        _cycleLocation.delegate = self;

    }
    [_cycleLocation startUpdatingLocation];

}

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation     *)newLocation fromLocation:(CLLocation *)oldLocation {

    NSLog(@"didUpdateToLocation: %@", newLocation);
    CLLocation *currentLocation = newLocation;

    if (currentLocation != nil) {
    self.longitudeLabel.text = [NSString stringWithFormat:@"%.8f",    currentLocation.coordinate.longitude];
    self.latitudeLabel.text = [NSString stringWithFormat:@"%.8f",    currentLocation.coordinate.latitude];

    }
}



- (void) locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
    NSLog(@"%@",error);

    if ( [error code] != kCLErrorLocationUnknown ){
        [self stopLocationManager];
    }
}

- (void) stopLocationManager {
    [self.cycleLocation stopUpdatingLocation];
}



@end

He echado un vistazo en línea y me he dado cuenta de que debería usarMKPolylineY dale las coordenadas. Pero no estoy seguro de cómo almacenar las ubicaciones y luego enviarlas para usarlas.MKPolyline para trazar los puntos, continuamente mientras la aplicación se está ejecutando.

Respuestas a la pregunta(2)

Su respuesta a la pregunta