Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Grabbing pictures of a user's "follows" profile pictures from Instagram

Based on Instagram's API documentation, I implemented this code to grab the profile pictures of the "follows" for the logged in Instagram user on my app:

NSString *urlString = [[NSString alloc] initWithFormat:@"https://api.instagram.com/v1/users/3/follows?count=99&access_token=%@", self.accessToken];

I do get profile pictures but they do not match the profile pictures of the "follows".

To double check, I logged in with another instagram user, and the pictures being returned are the same.

Any ideas how to fix this?

4 Answers

Stone Preston
Stone Preston
42,016 Points

looking at your string it looks like you are getting the follows of a static user with id = 3. use self instead of 3 to get the follows for the current user

 NSString *urlString = [[NSString alloc] initWithFormat:@"https://api.instagram.com/v1/users/self/follows?count=99&access_token=%@", self.accessToken];

Hi Stone: Thank you very much. I wish Instagram's doc would be a bit more elaborate for not so savvy iOS learners like myself ;)

Stone Preston
Stone Preston
42,016 Points

yeah its pretty barebones it seems.

Stone: Another quick question for you. What are the advantages of working with this for Instagram: https://github.com/crino/instagram-ios-sdk

As opposed to what we are doing in the course material (rest api I guess?).

Stone Preston
Stone Preston
42,016 Points

not sure really. that has not been updated in a year though, so it might not work well

Ok Stone. Thank you again :)