I have a json file and in this json I have different latitude and longitude and status. I want to check my status and based on lat and long show status pin on my map. I mean if my status is active : green pin if my status is expired show Red if my status is confidential show gray pin.
Here is my json :
[
{
"status": "active",
"latitude": 56.715866,
"longitude": -118.281757
},
{
"status": "expired",
"latitude": 56.715860,
"longitude": -118.281757
},
{
"status": "confidential",
"latitude": 56.715111,
"longitude": -118.281117
}]
I can print all json on my log here is my method :
-(void)getPin
{
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:BASED_URL]];
[request setHTTPMethod:@"GET"];
[request setValue:@"/json;charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
NSURLResponse *response;
NSData *GETReply = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response error:nil];
NSString *theReply = [[NSString alloc] initWithBytes:[GETReply bytes] length:[GETReply
length] encoding: NSASCIIStringEncoding];
NSLog(@"Reply: %@", theReply);
}
I have 3 pin image in my xcode I also have mapView. My question is how to show this 3 pins based on my json on map?
Thanks in advance! Appreciate if you can provide me the code