Giphy / giphy-ios-sdk

Home of the GIPHY SDK iOS example app, along with iOS SDK documentation, issue tracking, & release notes.
https://developers.giphy.com/
Mozilla Public License 2.0
116 stars 52 forks source link

Couldn't map GPHMedia: GPHJSONMappingError(description: "Need Request type to map the object") #261

Open PeaceDuhuanan opened 3 days ago

PeaceDuhuanan commented 3 days ago

after i got the data from api, i try to use mapData function to decode the dictionary data, i got an error let config = GPHRequestConfig.init() config.base = "https://api.giphy.com" config.path = "/v1/videos/search" config.apiKey = "xxxxxxxxxxxxxxxx" let query = URLQueryItem.init(name: "q", value: "ring") let query1 = URLQueryItem.init(name: "apiKey", value: "xxxxxxxxxxxxxxxx") let query2 = URLQueryItem.init(name: "limit", value: "5")

config.queryItems = [query,query1,query2]
config.method = .get
client.httpRequest(with: config) { data, response, error in
    do {
        guard let data = data else { return }

        let tData = try? GPHListMediaResponse.mapData(data, options: [:])
    }catch {
    }

}

Couldn't map GPHMedia: GPHJSONMappingError(description: "Need Request type to map the object")

how to use the function to decode data

cgmaier commented 2 days ago

hey @PeaceDuhuanan what are you hoping to accomplish with this code that you unable to via implementation of GiphyGridController or GiphyViewController?

these APIs your issue references are intended to support the SDK's internal functionality and aren't intended to be used independently of the UI components. We'll take a look at seeing if we can mark these interfaces internal so as to not confuse developers going forward.