Supporto The Movie Database

I'm trying to remove a movie from the watchlist. When I set "movie_watchlist" as a string ("false") I get the response "status_code": 12,"status_message": "The item/record was updated successfully" but nothing is changed and this is not the response I'm supposed to get back. When I set "movie_watchlist" as a boolean (false) I get the response "status_code":5,"status_message":"Invalid parameters - Your request parameters are incorrect" but I can't figure out what parameters would be wrong.

NSString *movieID = [self.detailItem objectForKey:@"id"];
BOOL *flag = false;
NSLog(flag ? @"True" : @"False");
NSDictionary *tmp = [NSDictionary dictionaryWithObjectsAndKeys:movieID, @"movie_id", flag, @"movie_watchlist", nil];
NSError *error;
NSData *postdata = [NSJSONSerialization dataWithJSONObject:tmp options:0 error:&error];
NSString *urlRequest = [NSString stringWithFormat:@"http://api.themoviedb.org/3/account/%@%/movie_watchlist?session_id=%@%&api_key=###",userID, [_wrapper objectForKey:(__bridge id)kSecAttrService]];

NSMutableURLRequest *request = [NSMutableURLRequest
                                requestWithURL:[NSURL URLWithString:urlRequest]];


[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postdata]; 
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

2 risposte (nella pagina 1 di 1)

Jump to last post

Hi nevrothwen,

You should definitely only be using booleans. If I do the following cURL request, everything seems to work ok:

curl -H "Accept: application/json" -H "Content-Type: application/json" -d "{'movie_id': 550, 'movie_watchlist': true}" "http://api.themoviedb.org/3/account/548/movie_watchlist?api_key=###&session_id=###"

I can't seem to be able to reproduce the issue you are describing.

I solved my issue. The boolean needs to be added to the dictionary as an NSNumber:

 NSNumber *flag = [[NSNumber alloc] initWithBool:TRUE];

Non riesci a trovare un film o una serie Tv? Accedi per crearlo.

Globale

s focalizza la barra di ricerca
p apri menu profilo
esc chiudi una finestra aperta
? apri finestra scorciatoia tastiera

Su tutte le pagine di media

b torna indietro (o al precedente quando applicabile)
e vai alla pagina di modifica

Nelle pagine delle stagioni TV

(freccia destra) vai alla stagione successiva
(freccia sinistra) vai alla stagione precedente

Nelle pagine degli episodi TV

(freccia destra) vai all'episodio successivo
(freccia sinistra) vai all'episodio precedente

Su tutte le pagine di immagini

a apri finestra aggiungi immagine

Su tutte le pagine di modifica

t apri selettore traduzione
ctrl+ s invia modulo

Sulle pagine di discussione

n crea nuova discussione
w segna come visto/non visto
p cambia publico/privato
c cambia chiuso/aperto
a apri attivita
r rispondi alla discussione
l vai all'ultima risposta
ctrl+ enter invia il tuo messaggio
(freccia destra) pagina successiva
(freccia sinistra) pagina precedente

Impostazioni

Vuoi valutare o aggiungere quest'elemento a una lista?

Accedi