Convertendo um comando CURL para o Objetivo C
Estou tendo dificuldade em transformar esse comando curl para o meu código de objetivo C:
curl -u 0ef106c78146a23becba9105d1e:X -H "Accept: application/json" -H "Content-Type: application/json" https://boomboom.c27.imonggo.com/api/products.json
Aqui está o meu código C objetivo:
NSError *theError = NULL;
NSURL *theURL = [NSURL URLWithString:@"https://boomboom.c2.imonggo.com/api/products.json"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0f];
[theRequest setValue:@"0ef106c78146a23becba9105d1e" forHTTPHeaderField:@"username"];
[theRequest setValue:@"x" forHTTPHeaderField:@"password"];
[theRequest setValue:@"application/json" forHTTPHeaderField:@"Accept:"];
[theRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type:"];
NSURLResponse *theResponse = NULL;
NSData *theResponseData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&theResponse error:&theError];
Provavelmente meu problema está nos campos do cabeçalh