Xcode 9 在 swift 中调试时崩溃 [英] Xcode 9 crashes when debugging in swift

查看:66
本文介绍了Xcode 9 在 swift 中调试时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新的 RxSwift 库进行反应式编程,但在 Xcode 9.1 中调试我的代码时遇到了一个奇怪的问题!我在 tableView 标头中有一个 collectionView 并将 collectionViewselectedItem 绑定到 ViewModel 变量以过滤掉部分项目.但是当我更改 collectionView 的选定项目时,Xcode 崩溃了,我无法弄清楚问题所在!是与我使用的库有关还是 Xcode 错误?

I'm using the latest RxSwift library for reactive programming and facing a strange problem when debugging my code in Xcode 9.1! I have a collectionView inside tableView header and bind selectedItem of collectionView to ViewModel variable to filter out section items. But when I change selected item of collectionView Xcode crashes and I can't figure out the problem! Is it related to libraries that I use or it's Xcode bug?

推荐答案

既然我也遇到了类似的问题,也许我的解决方案"也能帮到你:

Since I had a similar problem, maybe my "solution" will help you as well:

在浏览了 RxSwift github 问题之后,我遇到了这个问题:https://github.com/ReactiveX/RxSwift/issues/1463

After browsing the RxSwift github issues for a bit I came across this issue: https://github.com/ReactiveX/RxSwift/issues/1463

虽然不完全相同,但我尝试了建议的解决方案 - 将 Pod 的优化级别从无提升到快速.

While not exactly the same, I tried the proposed solution - Bumping the Pods' Optimization level from None to Fast.

成功了.

显然,当通过 CocoaPods 安装并在调试模式下运行时,RxSwift 的断言不仅会使应用程序崩溃,还会使 IDE 本身崩溃.至少这是我从整个磨难中得到的.现在,虽然提议的解决方案在技术上可能不是最好的(因为我们现在似乎忽略了实际上可能很重要的断言),但它让我的代码再次工作.

Apparently when installed via CocoaPods and when running in Debug mode RxSwift's asserts not only crash the app but also the IDE itself. At least that's what I got from the whole ordeal. Now, while the proposed solution may not be the technically best one (since we're now seemingly ignoring asserts that may actually be important), it got my code working again.

XCode 项目设置中设置的位置和内容的屏幕截图

这篇关于Xcode 9 在 swift 中调试时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆