Good afternoon,
I have an app that asks the user to log in thanks to twitter's doc found there: Log in with twitter. Then, I can successfully load the user's timeline. This timeline loads in a NavigationController which has the interface TWTRTimelineViewController. Now, I would like that when one user holds his finger on a tweet, or just click on one tweet, rather than opening Safari to display it, it pops up a button where I'll be able to work on the tweet after clicking. I will need to get access to the text and the image of the tweet. From my understanding, I will need to delegate all the tweets to some kind of TWTRTweetView controller to work on them but I'm not so sure how, since I'm completely new to this. I did try to read the doc but couldn't really get it, and most of the example are written in Swift. I'm also not sure how I'm supposed to access the tweet's properties. I have tried STTwitter where I played with some JSON formatted texts and where I was able to get the text and the image URL but I can't figure out how to do so directly with TwitterKit. Here's my actual code of the controller that display the timeline:
#import "TwitterTimelineViewController.h"
#import <TwitterKit/TwitterKit.h>
#import "AppDelegate.h"
@interface TwitterTimelineViewController ()
@property (strong, nonatomic) IBOutlet UITableView *TwitterTableView;
@end
@implementation TwitterTimelineViewController
TWTRUserTimelineDataSource *userTimelineDataSource;
- (void)viewDidLoad {
[super viewDidLoad];
AppDelegate *delegate=(AppDelegate *)[[UIApplication sharedApplication] delegate];
[[Twitter sharedInstance] startWithConsumerKey:@"myConsumerKey" consumerSecret:@"myConsumerSecretKey"];
TWTRAPIClient *APIClient = [[TWTRAPIClient alloc] init];
userTimelineDataSource = [[TWTRUserTimelineDataSource alloc] initWithScreenName:delegate.twitterUsername APIClient:APIClient];
self.dataSource = userTimelineDataSource;
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
return [[Twitter sharedInstance] application:app openURL:url options:options];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Any help would be awesome!
Cheers, Theo.