我在操场上尝试一些 RXSwift 代码,而 XCode 每隔几分钟就会用彩虹微调器冻结。然后 XCode 停止响应,必须强制退出并重新启动。这发生在多个项目和 Mac 上。项目文件中的常规 RXSwift 代码不会导致崩溃。
在游乐场模式下使用 RXSwift 时如何修复 XCode 冻结?
import RxSwift
import RxCocoa
import PlaygroundSupport
import Foundation
var str = "Hello, playground"
print(str)
let subject = BehaviorSubject(value: "seed")
let replayed = subject.replay(1)
let sequence = Observable.of("first","Second") //random crashes as I type and the console outputs error messages.
replayed.connect()
replayed.subscribe(onNext: { value in
print(value)
}, onError: { error in
print("Received Error")
}, onCompleted: {
print("Received Completion")
})
这是我的播客文件:
platform :ios, '11.0'
use_frameworks!
pod 'RxSwift'
pod 'RxCocoa'
target 'RxSwiftPlayground'
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings.delete('CODE_SIGNING_ALLOWED')
config.build_settings.delete('CODE_SIGNING_REQUIRED')
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$PODS_CONFIGURATION_BUILD_DIR'
end
end
end
我认为我唯一的症状是强制退出后,我在控制台中收到此错误,直到我重建项目(它正在编译并在冻结之前完成了代码)
Playground execution failed:
error: RxSwift.playground:3:8: error: no such module 'RxSwift'
import RxSwift