Code Monkey home page Code Monkey logo

instagram-ios-sdk's People

Contributors

bryant1410 avatar crino avatar dblandin avatar ergunkocak avatar gillesfabio avatar rudyryk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instagram-ios-sdk's Issues

Is there a way where I can differentiate between different requests?

When a view is loaded, I send out 2 requests, 1st is requesting for users/self/feed" (user feed), and 2nd is requesting for "users/self" (user info).

Those 2 requests may not be returned in the order that I have requested them. Is there a way that I can differentiate between the 2 requests since Instagram always returns the JSON dictionary as "data"?

Otherwise the next solution I can think of, which I don't prefer, is to wait till I receive the results of the 1st request before I start sending the 2nd request.

How to like

How can I use your sdk to post a like on a photo?

Thanks,
L

EDIT: Figured it out
`
-(void)likeImage:(NSString_)imageId
{
NSString_ methodName = [NSString stringWithFormat:@"media/%@/likes", imageId];
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[m_Instagram requestWithMethodName:methodName
params:params
httpMethod:@"POST"
delegate:self];
}

-(void)unlikeImage:(NSString_)imageId
{
NSString_ methodName = [NSString stringWithFormat:@"media/%@/likes", imageId];
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[m_Instagram requestWithMethodName:methodName
params:params
httpMethod:@"DELETE"
delegate:self];
}
`

Cannot compile it

Hi,
I'm using xcode 4.6.2 and have 2 problems with it. First, the project does not compile in a blank project, it says that can't synthesize weak references and the error persists even if i remove the synthesizes, i have to make the variables strong in order to work.
Second problem is that i'm trying to use it in a larger project, with fb integration also if matters, and get different 2 errors that i can't fix. Your example works instead but i can't see any difference in settings. Thanks

Ld /Users/Cristi/Library/Developer/Xcode/DerivedData/Instaslider-aqebwmejbvqneyakujwnvwcbpaal/Build/Products/Debug-iphoneos/Instaslider.app/Instaslider normal armv7
cd /Users/Cristi/Documents/iphone/Instaslider
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/Cristi/Library/Developer/Xcode/DerivedData/Instaslider-aqebwmejbvqneyakujwnvwcbpaal/Build/Products/Debug-iphoneos -F/Users/Cristi/Library/Developer/Xcode/DerivedData/Instaslider-aqebwmejbvqneyakujwnvwcbpaal/Build/Products/Debug-iphoneos -F/Users/Cristi/Documents/iphone/Instaslider/../../facebook-ios-sdk/build -filelist /Users/Cristi/Library/Developer/Xcode/DerivedData/Instaslider-aqebwmejbvqneyakujwnvwcbpaal/Build/Intermediates/Instaslider.build/Debug-iphoneos/Instaslider.build/Objects-normal/armv7/Instaslider.LinkFileList -dead_strip -lsqlite3.0 -ObjC -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework CoreImage -framework CoreVideo -framework CoreMedia -weak_framework AdSupport -weak_framework Accounts -weak_framework Social -framework FacebookSDK -framework MediaPlayer -framework AVFoundation -framework AssetsLibrary -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/Cristi/Library/Developer/Xcode/DerivedData/Instaslider-aqebwmejbvqneyakujwnvwcbpaal/Build/Products/Debug-iphoneos/Instaslider.app/Instaslider

Undefined symbols for architecture armv7:
"OBJC_CLASS$_Instagram", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

(null): "OBJC_CLASS$_Instagram", referenced from:

(null): Objc-class-ref in AppDelegate.o

(null): Symbol(s) not found for architecture armv7

(null): Linker command failed with exit code 1 (use -v to see invocation)

invalidated session on error?

I noticed that if requestState == kIGRequestStateError, you invalidate the session. Isn't that a bit extreme? An error can happen for lots of reasons. To invalidate the entire session seems erroneous.

Instagram.m - line 104

Sample app get 503 service unavailable on a brand new account

I have been using this sdk for a while now and today it has started throwing errors. The error is displayed as an alert stating InstagramErrorDomain 10000. Upon further investigation it is an issue with parsing the JSON response from instagram, this parse fails as what was received was really html in the form of

503 Service Unavailable

No server is available to handle this request.

I thought this might be an issue with my instagram account so I created a brand new one but still received this errors.

Any ideas?

Tutorial: How to follow a user

For everyone who has the same question that I had, I figured it out so here is the method to follow a user in the wonderful example app by @crino !

First, in IGViewController.m you have to change the login methods so that the user authorizes the app to change relationships:

At the end of -(void)viewDidLoad add the @"relationships" scope in the array of authorization:

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];

    UIButton* loginButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [loginButton setTitle:@"Login" forState:UIControlStateNormal];
    [loginButton sizeToFit];
    loginButton.center = CGPointMake(160, 200);
    [loginButton addTarget:self 
                    action:@selector(login) 
          forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:loginButton];


    IGAppDelegate* appDelegate = (IGAppDelegate*)[UIApplication sharedApplication].delegate;

    // here i can set accessToken received on previous login 
    appDelegate.instagram.accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"accessToken"];
    appDelegate.instagram.sessionDelegate = self;
    if ([appDelegate.instagram isSessionValid]) {
        IGListViewController* viewController = [[IGListViewController alloc] init];
        [self.navigationController pushViewController:viewController animated:YES];
    } else {
        [appDelegate.instagram authorize:[NSArray arrayWithObjects:@"comments", @"likes",@"relationships", nil]];                //ADDED @"relationships" !
    }
}

Next, also in IGViewController.m, in the -(void)login method, do the same thing:

-(void)login {
    IGAppDelegate* appDelegate = (IGAppDelegate*)[UIApplication sharedApplication].delegate;
    [appDelegate.instagram authorize:[NSArray arrayWithObjects:@"comments", @"likes",@"relationships", nil]];   ADDED @"relationships" again !

Then you can switch to the view controller where you want the user to follow another user

(WARNING: In the IGListViewController, the app crashes after running the follow method cause the "data" array changes and the table view can't show the followers anymore so I advise you to either use another view controller or to comment out all the tableView stuff in IGListViewController.m and in IGListViewController.h change "UITableViewController" to "UIViewController")

and, in the action you want, add the following code:

IGAppDelegate* appDelegate = (IGAppDelegate*)[UIApplication sharedApplication].delegate;

    NSString *accessToken = [[NSUserDefaults standardUserDefaults]objectForKey:@"instagramAccessToken"];


    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"follow", @"action", accessToken , @"ACCESS_TOKEN" , nil];

    [appDelegate.instagram requestWithMethodName:@"users/123456/relationship"
                                          params:params
                                      httpMethod:@"POST"
                                        delegate:self];

Replace "123456" in the method name with the instagram ID of the user you want to follow (just go to this website to lookup any instagram id: http://jelled.com/instagram/lookup-user-id)

In order to unfollow, block, etc. a user just replace "follow" with the action from Instgaram API relationship endpoints.

Hope I forgot nothing if you still have questions or something doesn't work, just comment :)

LogOut from safari

Hi Crino
When we log out from our application then it end the scop of Auth but safari still hold the detail of logged in user, if we again go for log in then it will renew Auth with previously logged in user. How can we logged out from safari as well..?

Session Persisting though App Close

I guess this is more of a question,

Is there a way to hold the active session once a user has authenticated. The situation is as follows : users logs in, everything works > user closes app and re opens a while later , app dies because it doesn't have the right session (error 400)

Is this possible in this sdk?

Several requests from one VC

If I need send 2, 3 or more request from same ViewController, how I can do this? And how I can distinguish different data result in "request:(IGRequest *)request didLoad:(id)result"?

The same redirct uri problem

Hi i'm trying to connect with instagram but i'm getting the same error as previous issues :
"Redirect uri does not match the registered redirect uri"
but i'm sure it's the same uri where ig[Client Id]://authorize is redirection uri.
and in my plist file since i'm using also facebook in my test application see what I have in the image below
Capture d e cran 2013-01-20 a 15 08 12

and in my delegate :

  • (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
    {
    if ([url.description hasPrefix:@"fb"])
    {
    return [[[FbManager sharedManager] facebook] handleOpenURL:url];

    }
    else
    {
    return [self.instagram handleOpenURL:url];
    }

}

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

if ([url.description hasPrefix:@"fb"])
{
    return [[[FbManager sharedManager] facebook] handleOpenURL:url];


}else
{
    return [self.instagram handleOpenURL:url];
}

}

can anyone help please ?

Cocoapods

Hi @crino , could you make this available on CocoaPods? Thanks.

Login / Logout using UIWebView Modal View Controller

Hi, can I have an example on how to login and logout using a UIWebView in a ModalViewController please?

I also wish to know how can I create an "instagram" instance in another class, which I use as my AppDirector class, rather than having to do it in the app delegate.
(The AppDirector class is my initial view controller, which is also the rootViewController of my side menu system).

I have tried my best to edit the codes myself but I kept failing. Can I get some help? Thanks so much in advance for this library and your help!

how to use it

hello can you give some note to how it's implemented in app

POST

Hello Crino,
How can I POST the following using your sdk

POST/users/user-id/relationship

Thank you
Cem Kacmaz

Cannot add redirect URI "http://ig" + "clientId" + "://authorize"

A while back I had setup "http://ig" + "clientId" + "://authorize" as a redirect URI in Instagram client manager. I needed to add a sandbox invite to the client but it was throwing an error "Submit a valid website" and highlighting the Redirect URI field as red. I removed it to be able to add the invite but I now cannot add it back in.

I have tried numerous variations
http://ige1716724820542e9a39ec32654785ab8://authorize
http://ige1716724820542e9a39ec32654785ab8
I continue to receive the submission error.

requestWithParams don't get answers

i'm trying to implement your example in my own project. obviously before i make a request, i do login. anyway this is my header file:

import "SocialMapAppDelegate.h"

@interface InstagramPhotos : BasciPhotoDictionary

@EnD

and this is my implementation file:

import "InstagramPhotos.h"

@implementation InstagramPhotos

-(void)requestForPhoto
{
SocialMapAppDelegate* appDelegate = (SocialMapAppDelegate*)[UIApplication sharedApplication].delegate;

// here i can set accessToken received on previous login if there is
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"users/self/followed-by", @"method", nil];
[appDelegate.instagram requestWithParams:params
                                delegate:self];

}

pragma mark -request delegate

  • (void)request:(IGRequest )request didFailWithError:(NSError *)error {
    NSLog(@"Instagram did fail: %@", error);
    UIAlertView
    alertView = [[UIAlertView alloc] initWithTitle:@"Error"
    message:[error localizedDescription]
    delegate:nil
    cancelButtonTitle:@"Ok"
    otherButtonTitles:nil];
    [alertView show];
    }
  • (void)request:(IGRequest )request didLoad:(id)result {
    NSLog(@"Instagram did load: %@", result);
    NSLog(@"risutato %@",[result objectForKey:@"data"]);
    // self.data = (NSArray
    )[result objectForKey:@"data"];

}

@EnD

the problem is that the delegate methods are never called. what is wrong?
thank you

Printing Instagram photo captions with emoji unicode characters

I am attempting to consume and then print out an Instagram photo caption that contains emoji. The caption text returned in the dictionary looks like the following

text = "Sample comment. \Uf4f1";

I attempt to set an NSString equal to this value with the following line

NSString *caption = [NSString stringWithUTF8String:[[[igPhotoDict objectForKey:@"caption"] objectForKey:@"text"] UTF8String]]

The NSString then contains the following:

Sample comment. 

What is the proper way to handle this string containing unicode emoji characters?

Post Messages

Hi,

I want to post messages from my app to Instagram. Can anyone help me on this.

Thanks,
Nandini

Cocoa pods

I’ve recently added instagram-ios-sdk to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, instagram-ios-sdk doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

Logout !

Hi

How to logout not just inside the application, how to login with a new user because it always return to the first login

I think we must clear cookies from Safari

Thanks

Improved Documentation

I was very confused after going through the example project added to the repo. Would going through Facebook-iOS-SDK help me understand the flow better?

Delegates

The two delegates do not work together in the same UIViewController, just call IGSessionDelegate

Don't work delegate

In my project don't work IGRequestDelegate.

In AppDelegate: self.instagram = [[Instagram alloc] initWithClientId:CLIENT_ID
delegate:nil];

Authorization is ok, but when I'm using:

AppDelegate* appDelegate = (AppDelegate_)[UIApplication sharedApplication].delegate;
appDelegate.instagram.accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"instagramAccessToken"];
NSMutableDictionary_ params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"users/self/feed", @"method", nil];
[appDelegate.instagram requestWithParams:params
delegate:self];

In console i get next answer:
URL: https://api.instagram.com/v1/users/self/feed?access_token=ACCESS_TOKEN

IGRequestDelegate use with

  • (void)request:(IGRequest *)request didLoad:(id)result
  • (void)request:(IGRequest *)request didFailWithError:(NSError *)error

And it does not result.

follow method

Sorry this might be a stupid question but I just started using Instagram SDK... I opened the example project and just wondered if theres a follow method declared anywhere in this project.
Can someone please explain me how to access the "follow user" method? Please help me I'm new at Instagram SDK :$ :)

Redirect URI does not match registered redirect URI using instagram SDK

Hi Crino,
I stuck in very strange problem. I am constantly getting error "Redirect URI does not match registered redirect URI".
I have set Redirect URI as : "https://igfdabfbdacdd14f908a456195445a7e38://authorize"

Set URL Schema in .plist file as : "igfdabfbdacdd14f908a456195445a7e38://authorize"

And when i try to login i get URL like : "https://instagram.com/oauth/authorize?response_type=token&redirect_uri=igfdabfbdacdd14f908a456195445a7e38%3A%2F%2Fauthorize&scope=comments+likes&client_id=fdabfbdacdd14f908a456195445a7e38"

Can you help me out what i am doing wrong?

Any help is appreciated.

Thank you.

Check If User Has Liked Image

So I could either get the ids of the images the user has liked and compare with a particular image, or I could get the ids of the users who have liked a particular image and compare. However I'm curious as to whether there is an integrated method, or whether I'll have to do one of the methods stated above?

{"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI does not match registered redirect URI"}

Hi there! awesome SDK but am generating this URL and so far i only get this answer from instagram:

my Url generated in the app: https://instagram.com/oauth/authorize?response_type=token&redirect_uri=248796138fde415ca17f4f3f7d59d43b%3A%2F%2Fauthorize&scope=basic&client_id=248796138fde415ca17f4f3f7d59d43b

the response:
{"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI does not match registered redirect URI"}

any help would be very appreciated!

Regards,

Jorge.

Missing instagram-ios-sdk-Prefix

When adding sdk project as static library, it wob't compile, because there is no instagram-ios-sdk-Prefix.pch file present (or I can't find it), You just need to remove the pch reference from the project and remove it from the build settings... I hope it should be clear to you what the problem is, but let me know if you need more details to fix it, or want me to send a pull request :) 👍

Difference between request methods

Hi @crino ,

Could you explain what is the difference between

requestWithParams:delegate:

and

requestWithMethodName:params:httpMethod:delegate:

and an example of situations where one will be preferred over the other?

Many thanks!

How to logout and clear the safari credentials?

Hey Crino,

I want to thank you by the API, it is great!!

But I have a problem with logout feature, I don't know if it's a bug or a question...
When I call logout, the API invalidate the access token in the application's scope, it works great, but the login still alive in the safari's scope... so, if I want to login with other different user, I can't. How can I do that?

Seems that facebook API has the same issue: http://stackoverflow.com/questions/6226950/facebook-ios-sdk-logout-question

But there is a work around to avoid this: https://github.com/facebook/facebook-ios-sdk/pull/242/files

I have tried to find out how to do this in your API, but still nothing...

Can you help me?

(sorry my english!)

Several requests from one VC

If I need send 2, 3 or more request from same ViewController, how I can do this? And how I can distinguish different data result in "request:(IGRequest *)request didLoad:(id)result"?

Get the user name

Hey,

How can I get the username? I didn't find the point where I can get the "username" value... I just have the valid access token, but seems that they send the username at the response package... Look at the response format when we have authentication:

"If successful, this call will return a neatly packaged OAuth Token that you can use to make authenticated calls to the API. We also include the user who just authenticated for your convenience:"
{
"access_token": "fb2e77d.47a0479900504cb3ab4a1f626d174d2d",
"user": {
"id": "1574083",
"username": "snoopdogg",
"full_name": "Snoop Dogg",
"profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg"
}
}

Could you help me?

Thanks!

Session invalidation issues when no internet connection

Hi, Cristiano! First of all, thank you for the great library! :) 👍

I've faced the problem: session is invalidated (token is set to nil) on any error, even if there's just no Internet connection.

I'm not sure if this is an issue with library - may be the best practice is to handle such errors outside, but I've got a workaround at the moment: https://github.com/rudyryk/instagram-ios-sdk/commit/d9ca9f2ff3d2131a24c6fe8c1772794f9f63ddd8

Session is invalidated only when we get @"OAuthAccessTokenException" error.

What do you think?

is it possible to change the scheme url from code?

i experienced a problem with my app.. it experienced a heavy load of user at the same time (about 4000) and then instagram shut down my api... then... i had to submit a new version of the app to the app store and to wait a whole week for apple to authorised it... is there any way to control the url from the code so i can change it from my service if something like that happens again?

thank you very much!

Scope (Permissions) Error

I have use multi scope

code :
[appDelegate.instagram authorize:[[NSArray alloc] initWithObjects:@"comment",@"likes", nil ] ];

When I touch login button I got error message from instagram.com.
I think URL generate from iOS it's incorrect.

URL :
scope=comments%2Blikes

And I edit %2B to "+" It's worked.

URL :
scope=comments+likes

Safari connot open this page

Hi,
Thank you very much for this v ery useful sdk it's very kind from u. you're doing a great job by facilitating instagram integration. the sdk works fine for me but sometimes when i logout and the login safari shows an alert like "safari cannot open this page invalid adress" i'm trying to figure out why ... do you have an idea ? thx

Redirect URI does not match registered redirect URI

I have create an app on instagram. have set redirect URI as following:
https://igCLIENT_ID://authorize

In my iPhone project's info.plist, am giving igCLIENT_ID:// in URL SCHEME. but am getting the same error again and again on login. it takes user name, password and then shows this error.

I need to add instagram to my project asap. Any help will be much appreciated.

Thank you

Real-time Photo Updates

Hi Crino,

First of all: great work mate!
Thanks ;-).

And then a little question:
Do you think it's possible to use the Instagram Real-time API with this SDK? (http://instagram.com/developer/realtime/)
Would it be possible to respond to the GET/POST- requests Instagram will send, right from within an iOS app?

Kind regards,
wuotr

Get location id with user/self/feed

Hello,

Dear I did this one:

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"users/self/feed", @"method", nil];

but how to get the data of locations ?

an example:

cell.textLabel.text = [[self.data objectAtIndex:indexPath.row] objectForKey:@"location->id"];

^ I want to return the id of location

Thanks alot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.