Sto provando a creare un accesso nella mia app per iPhone.Come impostare un cookie con NSURLRequest?
NSURL *urlNew = [NSURL URLWithString:urlstring];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:urlNew];
NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setValue:length forHTTPHeaderField:@"Content-Length"];
[theRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[theRequest setHTTPBody: httpbody];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self startImmediately:YES];
[connection start];
Questo è il modo in cui ho posto i miei dati al server, funziona - ottengo una risposta. Il problema è che la risposta è il codice del lato login, non il codice dell'area "salvata". Penso di dover creare i cookie, in modo che il sito Web sappia che sono connesso.
Ho cercato su Internet ma non ho trovato nulla di utile. Quindi, come faccio a creare un cookie quando mi registro? Devo pubblicare questo cookie ogni volta, quando vado a un altro link nell'area "salvata"?
Spero che tu abbia capito il mio problema.
Greetz
si dovrebbe cambiare la tua domanda a "Come ottenere un biscotto con un NSURLRequest? " dato che hai detto che vuoi ottenere il cookie esistente senza crearne uno nuovo. – Maziyar