當我嘗試使用下面的代碼列出系統中的可用字體時,我收到附帶的錯誤消息。我的代碼有什麼問題,或者這是一個編譯器錯誤?for循環中的swift編譯器錯誤
for fontFamilyName: String! in UIFont.familyNames() {
for fontName: String! in UIFont.fontNamesForFamilyName(fontFamilyName) {
println("font: \(fontName)")
}
}
錯誤消息:
0 swift 0x0000000101678e08 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x00000001016792f4 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff8968a5aa _sigtramp + 26
3 libsystem_platform.dylib 0x0000000102a79a00 _sigtramp + 2034168944
4 swift 0x00000001015759b7 llvm::StoreInst::StoreInst(llvm::Value*, llvm::Value*, bool, llvm::Instruction*) + 55
5 swift 0x0000000100aca412 swift::irgen::IRBuilder::CreateStore(llvm::Value*, llvm::Value*, swift::irgen::Alignment) + 66
6 swift 0x0000000100a9737c (anonymous namespace)::PayloadEnumImplStrategyBase::initialize(swift::irgen::IRGenFunction&, swift::irgen::Explosion&, swift::irgen::Address) const + 124
7 swift 0x0000000100abd070 swift::irgen::SequentialTypeInfo<(anonymous namespace)::LoadableStructTypeInfo, swift::irgen::LoadableTypeInfo, (anonymous namespace)::StructFieldInfo, true>::initialize(swift::irgen::IRGenFunction&, swift::irgen::Explosion&, swift::irgen::Address) const + 224
8 swift 0x0000000100abd070 swift::irgen::SequentialTypeInfo<(anonymous namespace)::LoadableStructTypeInfo, swift::irgen::LoadableTypeInfo, (anonymous namespace)::StructFieldInfo, true>::initialize(swift::irgen::IRGenFunction&, swift::irgen::Explosion&, swift::irgen::Address) const + 224
9 swift 0x0000000100ae5a48 swift::SILVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::ValueBase*) + 31240
10 swift 0x0000000100add846 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8678
11 swift 0x0000000100a5ecd8 swift::irgen::IRGenModule::emitGlobalTopLevel() + 184
12 swift 0x0000000100acacc3 performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1859
13 swift 0x0000000100acb613 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 51
14 swift 0x0000000100a3d95a frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4842
15 swift 0x0000000100a3c65d main + 1533
16 libdyld.dylib 0x00007fff889d05fd start + 1
1. While emitting IR SIL function @_TFC10SwiftTests11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqCSo12NSDictionary__Sb for 'application' at /Users/hb/Developer/martsys/SwiftTests/SwiftTests/AppDelegate.swift:15:3
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
如果編譯器崩潰,那麼這是一個編譯器錯誤(無論您的代碼有多麼錯誤)。 –