RSS Feed

Error 403 while getFollowers : Twitter iPhone MGTwitterEngine

I was trying to access the followers list from my twitter account by using MGTwitterEngine. But it is giving error. Here is all step what i have done to fixed it.

1. In MGTwitterEngine.m change #define TWITTER_DOMAIN @”twitter.com” To #define TWITTER_DOMAIN @”api.twitter.com/1″

and  #define USE_LIBXML 0 to #define USE_LIBXML 1 (Most of the people are not doing this and getting no response)

2. In your working class.h add #import “MGTwitterEngine.h” and add its delegate <MGTwitterEngineDelegate>

3. In your working class.m add these methods:

#pragma mark TwitterEngineDelegate
- (void) requestSucceeded: (NSString *) requestIdentifier {
NSLog(@”Request %@ succeeded”, requestIdentifier);
}
- (void) requestFailed: (NSString *) requestIdentifier withError: (NSError *) error {
NSLog(@”Request %@ failed with error: %@”, requestIdentifier, error);
}
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)connectionIdentifier {

}
- (void)receivedObject:(NSDictionary *)dictionary forRequest:(NSString *)connectionIdentifier {

NSLog(@”Recieved Object: %@”, dictionary);
}
- (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)connectionIdentifier {

NSLog(@”Direct Messages Received: %@”, messages);
}
// This method will call when you received all your followers. I have used one NSMutableArray “friendsList” to store all followers information. You can modify this according to your need.
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier {

NSLog(@”User Info Received: %@”, userInfo);

friendsList = [[NSMutableArray alloc]init];

for (NSDictionary *u in userInfo ) {

NSDictionary *followersDic = [[NSDictionary alloc]initWithDictionary:u];
[friendsList addObject:followersDic];
[followersDic release];
}
[self.tableView reloadData];
}

This is all what i have added in my class and then calling this method: [[GetAppDelegate() facebook] requestWithGraphPath:@”me/friends” andDelegate:self]; And it return all my followers list.

I hope this code will help to those who have scratching his head from some couple of hours ;-)

!! Enjoy !!

About these ads

About Muzammil

Over the past 4 years, I have designed, developed and managed over 60 iPhone/iPad applications for many large-scale clients, some include Rolex, Ford, Makemark LLC, Source Digital Production, IT City (Kingdom of Saudi Arabia), R.Ø.S.A. Creation etc. These applications ranged from simple navigation bar application to high end user interface design for image processing, simple games with Core Graphics and OpenGL. Before started Triffort Technologies i was working in Ampere Software Pvt Ltd as a senior iOS Developer. I was the first employe of Ampere who started iPhone/iPad development in the company. In ampere i worked on some complex apps like Boxboss, Austin Post, User Tracking etc. Throughout my career, I have used Core Graphics, OpenGL, SQLite, Core Data, JSON, XML etc. I am very proficient in many design programs including Photoshop, Illustrator, Flash, iMove. Although I am very knowledgeable in all Adobe Products. Most the time i am designing my apps without taking help from any graphics designer. I love to make app from my designs. It feels great when you are creating app from scratch and no body else is involve in your ideas. You are free to do anything. As the Senior Developer and Team lead at Triffort Technologies, I managed a team of Technical Interactive Developers and Designers. As their manager I am responsible for scheduling, resource management, task reviews, process development and enhancements, employee reviews and new employee hiring. I believe good employee morale and communication are key factors to successful, creative work, therefore, positive feedback was part of my daily routine. But most of the time you can find me on my desk writing codes for some app. I love programming. This is my passion. I’m a team player. I am a motivated individual who enjoys taking on new challenges and learning new technologies. I am well organized and a proficient multi-tasker. I have strong problem solving skills such as the ability to use technology in creative ways to meet unique project requirements. I love to be challenged and I always have a positive outlook no matter how tight the deadline is. If you would like to contact me or find out more about my experience, please contact me at muzammil@triffort.com or you can Skype me at muz.iphonedev.

8 responses »

  1. It worked really awesome superb muzammil, keep it up

    Reply
  2. I am also facing the same problem even i followed the above steps.
    [[GetAppDelegate() facebook] requestWithGraphPath:@”me/friends” andDelegate:self];
    i am not getting where i have to call this method.can you suggest me.

    Reply
  3. hi,my requirement is getting the followers names,
    I am also facing the same problem even though i followed the above steps.
    I have one doubt that
    [[GetAppDelegate() facebook] requestWithGraphPath:@”me/friends” andDelegate:self];
    where i have to call this method in my app.iam confusing,can you please suggest me…..

    Reply
  4. Hi Srinivas. In my case i have allocated the Facebook in App delegate with object name facebook. And i have created one function “GetAppDelegate()” which return app delegate (i.e. [[UIApplication SharedApplication] delegate] ).
    And i am calling this “facebook” from some other class. by using the method:
    [[GetAppDelegate() facebook] requestWithGraphPath:@”me/friends” andDelegate:self]; In your calling class write all delegate methods of facebook. As i am giving this delegate self. I hope now you understand what i have done with my code. If you still face any issue..let me know. I will try to fix your problem. Thanks

    Reply
  5. Thanks Muzammil.I have done with twitter integration successfully by your suggestions but for facebook,i have connected through fbgraph-api, friends list i have to display in tableview by using the lazy loading concept.Now iam able to displaying the friends in table but my requirement is to use lazy loading concept.can you suggest me with the useful links,Thanks in advance….

    Reply
  6. @Srinivas: Lazy loading for friends list (name) or for friends images ?? If you like to use the lazy loading for friend’s images create your own NSOperationQueue in place of downloading images by using the NSData dataWithURL method.

    Reply
    • Hi Muzammil:Thanks for the reply..I have to use Lazy Loading concept for friends list names only.what is the best method to do?Thanks

      Reply
  7. Thank you. I saved me a couple of hours :)

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 68 other followers

%d bloggers like this: