mediaList property gives only string instead of array value
Closed this issue · 3 comments
serhatsezer commented
Checklist
- I've the latest update of Swiftinstagram.
- I've searched for existing GitHub issues.
- I've read the wiki pages.
- I've read the contibution guidelines.
Expected Behavior
I'm expecting to get URL array instead of one string value. In recentMedia(fromUser:success:failure:) method
Actual Behavior
It's gives only one string value it contains 20 recent media URLs
Steps to Reproduce the Problem
- Authenticate
- Call recentMedia(fromUser:success:failure:) method
- In success block API gives [InstagramMedia] and its images property is not array value.
AnderGoig commented
Hi @serhatsezer, I'm not sure if I'm understanding what's your problem. The images
property from InstagramMedia
contains the thumbnail, low and standard resolution images. For example, you can get the standard resolution image URL with: <media>.images.standardResolution.url
.
If you want the all the images inside of an array you could do the following:
api.recentMedia(fromUser: ..., success: { mediaList in
var urlImages = [URL]()
for media in mediaList {
urlImages.append(media.images.standardResolution.url)
}
// ...
}, failure: {
// ...
})
serhatsezer commented
Hi @AnderGoig,
Sorry, It's totally my mistake. Actually, API works perfectly but I misunderstood something. Thank you for your quick reply.
AnderGoig commented
No problem @serhatsezer, glad you made it work 👍