ios - Twitter Kit/Fabric “Show Timeline” Objective-C 示例构建失败

标签 ios objective-c twitter twitter-fabric

跟随 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/

相关文章:

css - 移动设备上 Web 应用程序的布局选项

ios - 未设置 AVAssetResourceLoader 委托(delegate)

iphone - 从 UIImageView 中删除最后一个绘图上下文

api - Twitter Account Activity API - 如何为事件订阅 webhook?

javascript - 类型错误 : "callback" argument must be a function

ios - 如何以编程方式设置 ScrollView 高度

iphone - 从 UIView 调用父方法

objective-c - 在每个 CGEventPost 之间添加中断

php - 使用 Twitter 的 REST API 检索速率限制状态

ios - 将 UITextView 占位符/文本放置在左上角