gkye/TheMovieDatabaseSwiftWrapper

api don't return movie genre

Closed this issue · 5 comments

hi,
first thank you for your job and i have a request about the api.
api don't return movie genre. can you fix this please?
thank you

gkye commented

No problem. Could you give me an example of the query you're trying to run? I've noticed Discover doesn't return any genres only genre_ids but Movie and TV do return genres which I will include in a couple minutes.

I try to load popular movie by requesting MovieMDB.popular function.
here my request: https://api.themoviedb.org/3/movie/popular?page=1&language=fr&api_key=[the key].
MovieMDB object doesn't contain movie genre or genre id.
Let me know if you need some help.
Thank you

gkye commented

Fixed the genres variable which is optional (will return nil on some queries). The MovieMDB.popular query should return an array of genre_ids but not genres. Run pod update and try the query below.

        MovieMDB.popular(apikey, language: "en", page: 1){
            popularMovies in
            let movie = popularMovies.movie!
            print(movie[0].title)
            print(movie[0].genre_ids)
        }

Ok thank you it works. if I encounter new issues, I inform you.

gkye commented

No problem and please do.