【问题标题】:APP crash in debug mode but work fine in release mode on iOS 8APP 在调试模式下崩溃,但在 iOS 8 上的发布模式下工作正常
【发布时间】: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'

我的构建设置是:

我的尝试:

  1. 将 RAC 版本更改为 2.5 但构建失败。
  2. 在 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


【解决方案1】:

当我将 Pods 放入 .gitignore 中,然后 pod install,解决了问题。

【讨论】:

    猜你喜欢
    • 2018-07-01
    • 1970-01-01
    • 2016-10-19
    • 1970-01-01
    • 2018-03-22
    • 2019-09-11
    • 2019-12-20
    • 2019-12-05
    • 1970-01-01
    相关资源
    最近更新 更多