I would like to return the value of "star_rating" from this NSDictionary retrieved using MKLocalSearch. The dictionary that is returned looks something like this after I apply valueForKeyPath:@"business" to it.
UID = 8094514780070527910;
URL = "http://www.uvm.edu";
attribution = (
{
attributionURLs = (
"yelp5.3:///biz/university-of-vermont-burlington",
"yelp4:///biz/university-of-vermont-burlington",
"yelp:///biz/university-of-vermont-burlington",
"http://yelp.com/biz/university-of-vermont-burlington"
);
sourceIdentifier = "com.yelp";
sourceVersion = 1;
}
);
canBeCorrectedByBusinessOwner = 1;
name = "The University of Vermont";
source = (
{
"source_id" = 647659235;
"source_name" = "geo_id";
},
{
"source_id" = dBeQ7Nq1LcngfTz7gKrjLA;
"source_name" = yelp;
},
{
"source_id" = A3H0613898;
"source_name" = "acxiom_us";
},
{
"source_id" = A1L0080070;
"source_name" = "acxiom_us";
},
{
"source_id" = A3H0614039;
"source_name" = "acxiom_us";
},
{
"source_id" = "university-of-vermont-burlington";
"source_name" = "yelp_alias";
}
);
"star_rating" = (
"4.5"
);
telephone = "+18026563131";}
My Code:
MKMapItem *firstMapItem = [response.mapItems objectAtIndex:0];
NSDictionary *bizdic = [firstMapItem valueForKeyPath:@"business"];
NSLog(@"%@", bizdic);
//Problem Occurs Here
NSLog(@"%@", [bizdic valueForKeyPath:@"\"star_rating\""]);
Every time I go to print the value of "star_rating" to the console the app crashes and produces the following error:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GEOBusiness 0x160c5f20> valueForUndefinedKey:]: this class is not key value coding-compliant for the key "star_rating".'
If I use a value like telephone instead of "star_rating" it returns the telephone number no problem. This is my first time using MKLocalSearch so any advice is appreciated.