如何使用 Fabric api 显示来自特定用户时间轴的推文。 这是我的代码,我试图在数组中加载 tweety 的 id,然后在表格 View 中显示它们。
@implementation YourTweetViewController
- (void)viewDidLoad {
[super viewDidLoad];
[TwitterKit logInGuestWithCompletion:^(TWTRGuestSession *guestSession, NSError *error) {
if (guestSession) {
// Load tweets
__weak typeof(self) weakSelf = self;
NSArray *tweetIDs = @[@"20", // @jack's first Tweet
@"510908133917487104" // our favorite Bike tweet
];
[[[Twitter sharedInstance] APIClient] loadTweetsWithIDs:tweetIDs completion:^(NSArray *tweets, NSError *error) {
if (tweets) {
typeof(self) strongSelf = weakSelf;
strongSelf.tweets = tweets;
[strongSelf.tableView reloadData];
} else {
NSLog(@"Failed to load tweet: %@", [error localizedDescription]);
}
}];
} else {
NSLog(@"Unable to log in as guest: %@", [error localizedDescription]);
}
}];
}
Twitter Kit 1.5.0 支持时间线:
import UIKit
import TwitterKit
class ViewController: TWTRTimelineViewController {
convenience init() {
let client = Twitter.sharedInstance().APIClient
let dataSource = TWTRUserTimelineDataSource(screenName: "fabric", APIClient: client)
self.init(dataSource: dataSource)
}
override required init(dataSource: TWTRTimelineDataSource) {
super.init(dataSource: dataSource)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder has not been implemented")
}
}
关于ios - 使用 Fabric 在 TableView iOS 中加载时间线推文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28992551/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |