Objective-C equivalente de solicitud de rizo

Estoy tratando de manipular esta solicitud de curvatura en Objective-C:

curl -u username:password "http://www.example.com/myapi/getdata"

He implementado lo siguiente y estoy recibiendo un error de obtención de datosDomain=kCFErrorDomainCFNetwork Code=303 conNSErrorFailingURLKey=http://www.example.com/myapi/getdata:

// Make a call to the API to pull out the categories
NSURL *url = [NSURL URLWithString:@"http://www.example.com/myapi/getdata"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];

// Create the username:password string for the request
NSString *loginString = [NSString stringWithFormat:@"%@:%@", API_USERNAME, API_PASSWORD];

// Create the authorisation string from the username password string
NSData *postData = [loginString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

[request setURL:url];
[request setHTTPMethod:@"GET"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];

NSError *error;
NSURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

Esperaba que alguien pudiera ver dónde me estaba yendo mal con mi intento de manipular la solicitud de curvatura y apuntarme en la dirección correcta. ¿Hay algo obvio que me esté perdiendo? Los datos devueltos desde la API están en un formato JSON.

Respuestas a la pregunta(2)

Su respuesta a la pregunta