Twitter feed in an iOS app - how can i get a list feed just from my own account [without needing the app user to be signed into twitter]
Asked Answered
M

2

6

I'm making an iOS App that needs to show tweets in a List feed that i have set up. The problem is that [i don't want to use the end user's twitter account at all], i just want to show that one list feed in the app, by pulling its data in through the Twitter API.

Unfortunately for me, the Twitter API after version 1.1, requires authentication to do anything with it.

https://dev.twitter.com/docs/api/1.1/get/lists/statuses#example-request

All of the cases i have seen are using the end user's login within iOS to pull feeds in, which works, but here is my issue:

Can I authenticate these requests for the list feed, without the end user who is using the app needing to be signed into their own twitter account on iOS. i.e. the requests are authenticated with one specific twitter account [mine]?

or if there is a way to get the raw feed data without using the twitter API [i need to raw data to place into a UITableView within my app - i don't want to use a UIWebView].

this would make the feed accessible to end users without a twitter account [the list feed is public anyway, so i don't know why it needs authentication in the first place].

Many thanks!

Mesics answered 19/2, 2013 at 2:25 Comment(1)
Have you tried to create a list widget for web using your account ( twitter.com/settings/widgets ), then dig into its JS code to retrieve a public endpoint for that particular list, then use it in your app as the source? I see 'localhost' is supported automatically, so technically fetching it locally via app should be possible - but I didn't try it, it's an idea of the top of my head.Gelya
Z
14

Update: Their is seems to be a request limit issue in this approach, use following answer https://mcmap.net/q/1633123/-twitter-oauth-and-accesstoken-to-get-statuses-user_timeline-in-objective-c

It uses STTwitter,

It contains a method to check request limit

- (void)getRateLimitsForResources:(NSArray *)resources // eg. statuses,friends,trends,help
                 successBlock:(void(^)(NSDictionary *rateLimits))successBlock
                   errorBlock:(void(^)(NSError *error))errorBlock {

use this method to check current api limit, as now the api limit is for 15 mins interval, for more details visit Twitter 1.1 API Limit

=================================

If you haven't found solution yet, you can try this approach

  1. Register your app at twitter https://dev.twitter.com/apps

  2. On bottom of app information page "click on Create my access token" button it will create access token and secret

  3. Download FHSTwitterEngine https://github.com/fhsjaagshs/FHSTwitterEngine

Use following code to set access token to twitter engine:

self.engine = [[FHSTwitterEngine alloc]initWithConsumerKey:@"yourAppConsKey" andSecret:@"yourAppsecret"];
OAToken *token = [[OAToken alloc] init];

token.key = @"setaccessToken";
token.secret = @"setAccessTokenSecret";
[self.engine setAccessToken:token];

You can try this method to get tweets

[self.engine getTimelineForUser:username isID:NO count:1];

Also make sure SystemConfiguration.framework is added in your project

Zacharyzacherie answered 25/4, 2013 at 15:47 Comment(0)
C
1

Using STTwitter library you can get twitter feeds without login there are methods for getting all timelines or for particular lists using screenName first you set keys consumer and secret:

self.twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:kTwitterConsumerKey
                                               consumerSecret:kTwitterSecretKey];

and then to get timeline from list using screen name:

[_twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
    // NSLog(@"Access granted with %@", bearerToken);

    // load user tweets according to list
    [_twitter getListsStatusesForSlug:kSlug screenName:kScreenName ownerID:nil sinceID:nil maxID:nil count:nil includeEntities:0 includeRetweets:0 successBlock:^(NSArray *statuses) {
        //your code for getting feeds from array statuses
    } errorBlock:^(NSError *error) {
        NSLog(@"-- error: %@", error);
    }];

} errorBlock:^(NSError *error) {
    NSLog(@"-- error %@", error);
}];

this worked for me and if you want get followers list use FHSTwitter engine and method for checking status is:

[[FHSTwitterEngine sharedEngine] lookupFriendshipStatusForUsers:users areIDs:NO];
Candace answered 10/2, 2015 at 7:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.