我刚刚将RxSwift和RxCocoa容器添加到了我的项目中。当我尝试运行时,它以分段错误11结束
我试图删除该项目并重新创建它,但它仍在发生。
这是错误块
RxSwift/RxSwift/ViewController.swift:10:8: warning: file 'ViewController.swift' is part of module 'RxSwift'; ignoring import
import RxSwift
^
<unknown>:0: error: circular dependency between modules 'RxSwift' and 'RxRelay'
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/myMAC/Documents/Debanjan_iOS/RxSwift/RxSwift/ViewController.swift /Users/myMAC/Documents/Debanjan_iOS/RxSwift/RxSwift/AppDelegate.swift -emit-module-path /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/ViewController~partial.swiftmodule -emit-module-doc-path /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/ViewController~partial.swiftdoc -serialize-diagnostics-path /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/ViewController.dia -emit-dependencies-path /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/ViewController.d -emit-reference-dependencies-path /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/ViewController.swiftdeps -target x86_64-apple-ios12.0-simulator -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk -I /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator -F /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator -F /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator/RxCocoa -F /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator/RxRelay -F /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator/RxSwift -enable-testing -g -module-cache-path /Users/myMAC/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D DEBUG -D COCOAPODS -serialize-debugging-options -Xcc -working-directory -Xcc /Users/myMAC/Documents/Debanjan_iOS/RxSwift -enable-anonymous-context-mangled-names -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/RxSwift-generated-files.hmap -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/RxSwift-own-target-headers.hmap -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/RxSwift-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/RxSwift-project-headers.hmap -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator/RxCocoa/RxCocoa.framework/Headers -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator/RxRelay/RxRelay.framework/Headers -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Products/Debug-iphonesimulator/RxSwift/RxSwift.framework/Headers -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/DerivedSources-normal/x86_64 -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/DerivedSources/x86_64 -Xcc -I/Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -module-name RxSwift -o /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Build/Intermediates.noindex/RxSwift.build/Debug-iphonesimulator/RxSwift.build/Objects-normal/x86_64/ViewController.o -index-store-path /Users/myMAC/Library/Developer/Xcode/DerivedData/RxSwift-gjewryzxztmluifpnkaqwnrbconi/Index/DataStore -index-system-modules
0 swift 0x000000010cbf4ee3 PrintStackTraceSignalHandler(void*) + 51
1 swift 0x000000010cbf46bc SignalHandler(int) + 348
2 libsystem_platform.dylib 0x00007fff5ad89b5d _sigtramp + 29
3 libsystem_platform.dylib 0x00000001108c9384 _sigtramp + 3048470596
4 swift 0x0000000109e21f85 swift::SerializedModuleLoaderBase::loadModule(swift::SourceLoc, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 629
5 swift 0x0000000109f82de5 swift::ASTContext::getModule(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 245
6 swift 0x0000000109c655ff swift::performNameBinding(swift::SourceFile&, unsigned int) + 1695
7 swift 0x000000010954ec1a swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 3562
8 swift 0x0000000108a4d2f6 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 838
9 swift 0x0000000108a496de swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
10 swift 0x00000001089e77be main + 1246
11 libdyld.dylib 0x00007fff5aba43d5 start + 1
12 libdyld.dylib 0x000000000000005c start + 2772810888
error: Segmentation fault: 11
这是我的示例项目代码
import UIKit
import RxSwift
import RxCocoa
class ViewController: UIViewController {
@IBOutlet weak var resetBtn: UIButton!
@IBOutlet weak var validateBtn: UIButton!
@IBOutlet weak var secondErrorLabel: UILabel!
@IBOutlet weak var firstErrorLabel: UILabel!
@IBOutlet weak var secTxtField: UITextField!
@IBOutlet weak var firstTxtField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
setUpObservables()
// Do any additional setup after loading the view.
}
func setUpObservables() {
}
}
这是项目的podfile
target 'RxSwift' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for RxSwift
pod 'RxSwift', '~> 5.0.0'
pod 'RxCocoa', '~> 5.0.0'
end
答案 0 :(得分:0)
您将目标RxSwift
命名为与依赖项名称完全相同的名称。这可能是您使Xcode和Cocoapods变得混乱的原因。重命名您的项目,然后重试。