Closed Dzionis closed 6 years ago
Hey @Dzionis thanks for your help and your pull request (#8), unfortunately, I'm not sure thats correct. In fact, I have tested it and this was the Instagram API response:
{
"data": {
"id": "213135265",
"name": "Minsk-Arena",
"latitude": 53.9365,
"longitude": 27.4829
},
"meta": {
"code": 200
}
}
You can see the id
is a String
and I haven't had any parse issue, how have you tested it, or where did you find that?
Thanks! :thumbsup:
Thank you for quick reply @AnderGoig . I logged in by this code:
api.login(navController: navigationController!, scopes: [.basic, .likes, .followerList, .publicContent], success: {
// Do your stuff here ...
}, failure: { error in
print(error.localizedDescription)
})
and I got media by this code:
api.recentMedia(fromUser: "self", count: 5, success: { (mediaSet) in
}, failure: { (error) in
print(error.localizedDescription)
})
And i got response: [jsonParseError] - The data couldn’t be read because it isn’t in the correct format.
Oh :hushed:, I see.
It seems like the Instagram API returns a different type of id
depending on the called endpoint. The location id
returned from a media object is an Int
, as you said. But the location id
returned from a call to /locations/location-id
is a String
.
Unfortunately, your pull request (#8) would do the trick with the first example, but would fail with the second.
The only thing I can think of is to have an internal struct inside InstagramMedia.swift
for the location
property that would parse the id's as Int
.
Thank you very much, I wouldn't have discovered this without your help! 👍
Property 'id' should be Int in the 'InstagramLocation' model