AnderGoig/SwiftInstagram

mediaList property gives only string instead of array value

Closed this issue · 3 comments

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.

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: {
    // ... 
})

Hi @AnderGoig,

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

No problem @serhatsezer, glad you made it work 👍