Question

I am trying to add an annotation from property list. I found a solution here:

Xcode Annotation from Property List

but it gives me an error "use of undeclared identifier "racks"" and "use of undeclared identifier "GetRacks"" here:

   // Add annotations
    NSArray *bikePath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *bikeDocumentsDirectory = [bikePath objectAtIndex:0];
    NSString *path = [bikeDocumentsDirectory stringByAppendingPathComponent:@"data.plist"];

    NSDictionary* bikesDictionary = [[NSDictionary alloc] initWithContentsOfFile:path];
    GetRacks racks = [[GetRacks alloc] initWithDictionary:bikesDictionary];

    for(RackAnnotation *rackAnnotation in [racks getRacks])
    {
        [mapView addAnnotation:rackAnnotation];
    }

Can anybody help me with this?

Was it helpful?

Solution

You do not initialize

GetRacks racks

when racks is not a pointer.

GetRacks * racks = [[GetRacks alloc] initWithDictionary:bikesDictionary];

is gonna work just fine!

EDIT: change this:

GetRacks racks = [[GetRacks alloc] initWithDictionary:bikesDictionary];

to this:

GetRacks * racks = [[GetRacks alloc] initWithDictionary:bikesDictionary];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top