Objective C, how to send curl requests?


#1

Any Objective C developers or others able to help sending a curl request ? I’m just getting a null result :

NSURL *url = [NSURL URLWithString: [NSString stringWithFormat:@"https://api.transport.nsw.gov.au/v1/gtfs/alerts/sydneytrains"]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/x-google-protobuf" forHTTPHeaderField: @"Accept"];
[request addValue:@"apikey (myapikeyhere)" forHTTPHeaderField: @"Authorization"];
 
NSData *res = [NSURLConnection  sendSynchronousRequest:request returningResponse:NULL error:NULL];
NSString *myString = [[NSString alloc] initWithData:res encoding:NSUTF8StringEncoding];
NSLog(@"strrrr %@", myString);