Adding Annotation from Property List - use of undeclared identifier

500 views Asked by At

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?

1

There are 1 answers

11
Martol1ni On BEST ANSWER

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];