【发布时间】:2017-07-06 06:21:05
【问题描述】:
APP 在 iOS 9 和 iOS 10 上运行良好。然而,在 iOS 8 上,它在调试模式下运行时崩溃,但在发布模式下运行正常。
错误代码为:
[RACObserve(self.scrollView, contentOffset) subscribeNext:^(id x) {
NSInteger currentTableViewTag = self.scrollView.contentOffset.x / screenWidth;
NSLog(@"current tableView tag:%ld",(long)currentTableViewTag);
self.currentTableView = [self viewWithTag:currentTableViewTag];
}];
控制台日志信息为:
-[UIScrollView rac_valuesForKeyPath:observer:]:无法识别的选择器发送到实例 0x178153f0
ReactiveCocoa 版本是:
pod 'ReactiveCocoa','~>2.1.8'
我的构建设置是:
我的尝试:
- 将 RAC 版本更改为 2.5 但构建失败。
- 在 Google 上搜索,但没有想要的答案。
我的问题是:
ReactiveCocoa 有什么问题?为什么在发布模式下它可以,但在调试时它在 iOS 8 上崩溃?
希望有人能给点建议。
【问题讨论】:
-
@weakify(self); [RACObserve(self.scrollView, contentOffset) subscribeNext:^(id x) { @strongify(self); NSInteger currentTableViewTag = self.scrollView.contentOffset.x / screenWidth; NSLog(@"current tableView tag:%ld",(long)currentTableViewTag); self.currentTableView = [self viewWithTag:currentTableViewTag]; }]; -
你能试试上面的代码吗?
-
@LalKrishna 是的,即使我使用weakSelf它也会崩溃。
-
这是模拟器运行吗?
-
@LalKrishna 不,在装有 iOS 8 的 iPhone 5 上运行。
标签: ios objective-c crash reactive-cocoa