-3

I'm creating a tabbed iOS application. I need one of the tabbed pages to only show the IG feed of a specific user (not the user who logs in). How do I go about doing so?

Edited: Ok, now I've registered my app via the IG Developer page, and I've gotten my client id. Now I need the user's profile to load up in my web view.

Here is my code in my InstaViewController.m file:

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIActivityIndicatorView *activityView=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

    activityView.center=self.view.center;

    [activityView startAnimating];

    [self.view addSubview:activityView];
    // Do any additional setup after loading the view.
    NSURL *instagramURL = [NSURL URLWithString:@"instagram://user?username=MAMA_MIA"];

    if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
        [[UIApplication sharedApplication] openURL:instagramURL];

}

  }
Baby Groot
  • 4,637
  • 39
  • 52
  • 71
timirahj
  • 5
  • 4

1 Answers1

3

Using the following URI from the Instagram API, you can get any users feed if you know their user ID.

https://api.instagram.com/v1/users/{USER_ID}/media/recent/?client_id={CLIENT_ID}
Nick
  • 939
  • 1
  • 12
  • 19
  • Thanks, do I absolutely have to register to get a client id to do this? – timirahj Apr 28 '14 at 07:19
  • I believe so. If you don't add the client id on to the end of the URI you get an error returned. May be worth looking into the IG API further though. – Nick Apr 28 '14 at 07:27
  • Ok, I've got my client id. Now my webview is just showing a blank page. I'll show you my code . . . – timirahj Apr 28 '14 at 07:59
  • Ah, you were not clear in how you wanted to achieve this functionality. The URI I gave was assuming that you would be making a web service request, and displaying the results in a UICollectionView. – Nick Apr 28 '14 at 08:14
  • In that case, surely you just need: "instagram.com/{USERNAME}" – Nick Apr 28 '14 at 08:15
  • Yes, this was my first instinct, but the user's profile is private and wants it to remain that way (I guess to gain followers), and so it's making it a little more complex. – timirahj Apr 28 '14 at 08:21
  • You didn't mention that either. In that case, I don't know how you would handle private users - sorry. – Nick Apr 28 '14 at 08:22
  • Yeah, I think my best bet would be to convince my client to make the profile public for the sake of the app. – timirahj Apr 28 '14 at 08:24
  • If I wanted to go ahead and make the web service request, where would I do so in my implementation file? Would I create another class for it? . . . – timirahj Apr 28 '14 at 17:00
  • I mostly use AFNetworking for HTTP requests, and have a dedicated class which has methods that allow me to make the various CRUD requests. If this is the only request you will be making, then you could get away with doing it in the implementation file using something like NSURLRequest: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/Reference/Reference.html – Nick Apr 29 '14 at 07:27