跟随 Fabric/Twitter 套件文档显示用户时间线。但是,文档中的代码无法构建。
这是我的时间线 View Controller 中的代码,在 View 已加载时。
[[Twitter sharedInstance] logInGuestWithCompletion:^(TWTRGuestSession *guestSession, NSError *error) {
if (guestSession) {
TWTRAPIClient *APIClient = [[Twitter sharedInstance] APIClient];
TWTRUserTimelineDataSource *userTimelineDataSource = [[TWTRUserTimelineDataSource alloc] initWithScreenName:@"fabric" APIClient:APIClient];
self.dataSource = userTimelineDataSource; // <- build fail here
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
}];
Xcode 提示:“在类型为‘TimelineViewController’的对象上找不到属性‘数据源’。不确定为什么会这样,因为这基本上是文档示例中的逐字记录。
非常感谢任何帮助!
最佳答案
和 friend 谈过,帮我弄明白了
原来有这个
@interface TimelineViewController : UIViewController
需要改成这样
@interface TimelineViewController : TWTRTimelineViewController
在 TimeLineViewController 文件的 .h 中,之前我对 UIViewController 进行了子类化,而不是 Twitter Kit 中的“TWTRTimelineViewController”。原始类没有 self.datasource 的属性。另一方面,TWTRTimelineViewController 的子类可以。
关于ios - Twitter Kit/Fabric “Show Timeline” Objective-C 示例构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30824970/