crino / instagram-ios-sdk

Instagram SDK for iOS
http://www.followgram.me
228 stars 63 forks source link

Difference between request methods #36

Closed RyanTLX closed 10 years ago

RyanTLX commented 10 years ago

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!

crino commented 10 years ago

the only difference is that in 'requestWithParams:delegate:' you need to add 'method' name in params dictionary in 'requestWithMethodName:params:httpMethod:delegate:' you can pass 'method' name as parameter and, in addition, you can set the http method (GET, POST...)

RyanTLX commented 10 years ago

Hi @crino , pardon me but honestly, I still don't fully understand. Can you provide an example?

crino commented 10 years ago

if you take a look at example you can see the call:

    IGAppDelegate* appDelegate = (IGAppDelegate*)[UIApplication sharedApplication].delegate;
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"users/self/followed-by", @"method", nil];
    [appDelegate.instagram requestWithParams:params
                                    delegate:self];

the same call can be done by:

    IGAppDelegate* appDelegate = (IGAppDelegate*)[UIApplication sharedApplication].delegate;
    [appDelegate.instagram requestWithMethodName:@"users/self/followed-by"
                                    params:nil
                                    httpMethod:@"GET"
                                    delegate:self];