how to make Twitter API call in ios with FHSTwitterEngine?

738 views Asked by At

hey i want to call twitter api in my ios app with FHSTwitterEngine i have my URL but i dont know where to append my keys .This is my URL

https://api.twitter.com/1.1/geo/similar_places.json?lat=37.78&long=-122.41&name=Twitter

I make request with my credentials like this,

https://api.twitter.com/1.1/geo/similar_places.json?lat=37.78&long=-122.41&name=atm&oauth_access_token=XXXXXXX&oauth_access_token_secret=XXXXXXX&consumer_key=XXXXXX&consumer_secret=XXXXXX

can anyone guide me for this.

1

There are 1 answers

0
Smit Shah On

Try this. By using this code you can login to twitter and you can get logged in user's username and twitter id.

import FHSTwitterEngine.h

#import "FHSTwitterEngine.h"

And then in .m file write this

[[FHSTwitterEngine sharedEngine] permanentlySetConsumerKey:@"Your Consumer Key" andSecret:@"Your Consumer Secret"];
        [[FHSTwitterEngine sharedEngine] setDelegate:self];
        [[FHSTwitterEngine sharedEngine] loadAccessToken];
        [[FHSTwitterEngine sharedEngine] showOAuthLoginControllerFromViewController:self withCompletion:^(BOOL success) {
            NSString *ID = [[FHSTwitterEngine sharedEngine]loggedInID];// self.engine.loggedInUsername;
            if (ID.length > 0) {
                NSString *userID = [NSString stringWithFormat:@"%@",ID];
                NSLog(@"%@",userID);
            }
            else
            {
                NSLog(@"Not Logged In");
            }
            NSLog(success?@"L0L success":@"O noes!!! Log in failure!!!");
        }];