AnderGoig / SwiftInstagram

Instagram API client written in Swift
https://git.io/vdNAn
MIT License
580 stars 79 forks source link

mediaList property gives only string instead of array value #19

Closed serhatsezer closed 6 years ago

serhatsezer commented 6 years ago

Checklist

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

  1. Authenticate
  2. Call recentMedia(fromUser:success:failure:) method
  3. In success block API gives [InstagramMedia] and its images property is not array value.
AnderGoig commented 6 years ago

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 6 years ago

Hi @AnderGoig,

Sorry, It's totally my mistake. Actually, API works perfectly but I misunderstood something. Thank you for your quick reply.

AnderGoig commented 6 years ago

No problem @serhatsezer, glad you made it work 👍