MGTwitterEngine getting feeds - iPhone - iphone

So, in my app, I am trying to use MGTwitterEngine to read from a certain user on Twitter, and then log the recent posts in an array. Is it possible to do this with this library? I am trying to do this without logging in. Any help would be appreciate, thank you!

It can be easily done with MGTwitterEngine. You do it this way:
MGTwitterEngine *twitterng = [[MGTwitterEngine alloc] initWithDelegate:self];
[twitterng getUserTimelineFor:#"userName" sinceID:0 startingAtPage:0 count:8];
and it will call delegate method
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)connectionIdentifier
Hope this helps.

You need to get the feed url that contains the rss feeds. You don't need to login for that. Use MGTwitterEngine to get the tweets and set them into array. Then you simply need to reload the tableview.
Hope this helps.
Thanks,
Madhup

Related

iphone - How to get friends/ids with Twitter API?

How can I get Friends/Friend's IDs of my twitter account using Twitter API?
In this tutorial https://github.com/bengottlieb/Twitter-OAuth-iPhone and example of, I can just send the updates or send any direct messages, but I can't get any direct messages or Friend's IDs or any other things that can be found from the get methods.
How can I find any data that was parsed from the get methods? (Example: getPublicTimeline, getUpdate:(unsigned long)updateID, getDirectMessagesSinceID:, etc..)
Can anyone suggest how to solve this problem?
https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name=screennameofUser
yes.You have getFriends method.Also You have getFollowersIncludingCurrentStatus method.These methods will return to the following Callback,
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier
{
//Here You can parse userInfo and get the list
}

Using retweeted_by API with MGTwitterEngine - keeps on returning error 404

I'm trying to add a method to MGTwitterEngine to use twitter's retweeted_by API ( http://dev.twitter.com/doc/get/statuses/:id/retweeted_by ).
Here is what I've added to MGTwitterEngine.m (all the OAuth stuff is done, the other methods inside the engine work fine)
-(NSString *)getUsersWhoRetweetedTweetWithID:(unsigned long)ID {
NSString *path = [NSString stringWithFormat:#"statuses/70482402362933249/retweeted_by.xml"];
return [self _sendRequestWithMethod:nil path:path queryParameters:nil body:nil
requestType:MGTwitterUsers
responseType:MGTwitterUsers];
}
Note: I've already included the .xml format and a status ID - just to ensure there's nothing wrong with the data I'm passing on. When I call [_engine getUsersWhoRetweetedTweetWithID:0]; from my app controller, error 404 is returned "The operation couldn't be completed. (HTTP error 404.)".
I've tried it with a parameters NSDictionary & tried changing the request & response types.
Currently, I don't make use of MGTwitterEngine to check who RTd a tweet, I just use a non OAuth'd method - however this will not return protected users who RTd a tweet.
Can anyone give me a point in the right direction - it's being driving me crazy for the past few days! I really appreciate any input :)
Take a look here.....
How to do a RETWEET on an iPhone twitter app (MGTwitterEngine)
MGTwitterEngine does not support re-tweet method yet .. you have to manually add the parse to MGTwitterEngine .h and .m then the call out would be [_engine sendRetweet:(unsigned Long)];
Now I am in the process of trying to determine how you call out the unsigned long...if any one else has an answer to that I would be happy to hear it myself.

iPhone: what is the delegate for following users in MGTwitter engine

Can you tell (Twitter)
the delegates for following friend in twitter and getFollowersIncludingCurrentStatus this for followers
enableUpdatesFor: takes an NSString of the username. It's a method not a delegate.

How to send direct message with Twitter?

in my iphone application i have to send direct message throughout twitter,
the problem is that twitter had changed the authentication from basic authentication to oauth
and tutorial on the Web are out of date
so i use SAOauthTwitterEngine for the authentication part and all ok. but these classes don't use the api, so i have to use MGTwitterEngine for this.
the problem is that MGTE dont have oauth but only xauth and basic authentication, and i cant use this together anyone know how to do it? or know a tutorial that explain it.
thanks a lot.
i suggest you OAuth because xAuth requires you to send an email to twitter askeing them to give you the permission, and you have to write a reort on your application (this isn't good for a testing app)
have you tried this?
https://github.com/bengottlieb/Twitter-OAuth-iPhone
in my app I am sending direct messages to my twitter followers by using MGTwitterEngine let have a look:
appDelegate._engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self];
appDelegate._engine.consumerKey = kOAuthConsumerKey;
appDelegate._engine.consumerSecret = kOAuthConsumerSecret;
once you get authenticated this method get called
#pragma mark SA_OAuthTwitterControllerDelegate
- (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *)username {
NSLog(#"Authenicated for %#", username);
[appDelegate._engine sendDirectMessage:#"Test for Twitter direct message" to:username];
}
Hope this will help you.

How to integrate location information into Twitter app?

I'm trying to get a Twitter iPhone app working using Matt Gemmell's MGTwitterEngine. I can post tweets OK, but I can't work out how to attach location data to those tweets... anyone have any idea?
I've never used MGTwitterEngine but from looking at the code, it should be as simple as calling sendUpdate:withLatitude:longitude:. What have you tried? What did and what did not work? Please be more specific.
There is no way to do post tweets with location information with MGTwitterEngine as of now. I am currently working on bringing the library up to date. You can check github.com/freeatnet/MGTwitterEngine/tree/v2-dev for updates. I'll be pushing a commit containing a method for geo-aware updates today.
UPD. See commit # http://github.com/freeatnet/MGTwitterEngine/commit/512be99cca9f5787192633455300dcd788c7830c for location-aware updates.
Method signatures:
(NSString *)sendUpdate:(NSString *)status;
(NSString *)sendUpdate:(NSString *)status fromLocationLat:(float)locLat locationLong:(float)locLong;
(NSString *)sendUpdate:(NSString *)status inReplyTo:(unsigned long long)updateID fromLocationLat:(float)locLat locationLong:(float)locLong;