I have an app I am developing with a users timeline in a table view. It will be the same users timeline in every app. I have already coded this and it works perfectly. My issue is that when I change the API version from 1 to 1.1 in the call it stops working. All tweets will be going through a tweet sheet so I don’t need authentication. Do I need to add code other than just changing the API version in the call, or set up authorization just to display a timeline with the new API? I’m not adding any functionality other than simply displaying a single users timeline and using tweet sheets to respond. I have attached my code. Any help would be great. Thank you.
- (void)fetchTweets
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://api.twitter.com/1/statuses/user_timeline.json?include_rts=false&screen_name=johnnelm9r&count=100"]];
if (data == nil)
{
}
else
{
NSError *error;
tweets = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
error:&error];
}
dispatch_async(dispatch_get_main_queue(), ^{
[self.twitterTableView reloadData];
});
});
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
self.reachability = [Reachability reachabilityWithHostName:@"www.apple.com"];
[self.reachability startNotifier];
}
This is what I ended up coming up with. It calls just fine for what I need it to do. Hopefully it helps someone else as well.
I also added an easy loader and reachability. If you don’t need it just delete the NSNotification at the bottom.
And make sure to add the
Accounts and Social frameworks
and import their header files to your .m file you use it in.
Good luck!