gpt4 book ai didi

xcode - Swift 1.2 编译器段错误 11

转载 作者:行者123 更新时间:2023-11-30 10:13:22 27 4
gpt4 key购买 nike

这是 Xcode 6.4 和 Swift 1.2。我正在重新移植我在 Xcode7/Swift2 中编写的内容。删除 try/catch block 并将错误变量添加回来,这并不是很多工作。当我完成这一切时,编译器崩溃了。日志只指向一个函数,所以我逐行注释掉了内容。问题似乎出现在我向名为“Favorites”的 NSManagedObject 类分配或读取值时。

例如:

let fetchRequest = NSFetchRequest(entityName: "Favorites")
fetchRequest.sortDescriptors = [NSSortDescriptor(key: "eventDate", ascending: false)]
var err: NSErrorPointer = nil
if let fetchResults = managedObjectContext!.executeFetchRequest(fetchRequest, error: err) as? [Favorites] {
favorites = fetchResults
for f in favorites {
print(f)
//let id = f.eventId!
//eventids.append(id)

}

. . .

或者这样,注释行再次使编译器崩溃

//save fav to core data
let del: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let moc = del.managedObjectContext
let fav = NSEntityDescription.insertNewObjectForEntityForName("Favorites", inManagedObjectContext: moc!) as! Favorites
//fav.eventId = event.eventId
//fav.eventDate = event.eventDate

注释行会导致编译器崩溃。编辑也吓坏了,失去了配色方案。

不幸的是,转储对我来说意义不大,

0  swift                    0x000000010ff972b8 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x000000010ff97794 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff88b3deaa _sigtramp + 26
3 libsystem_platform.dylib 0x00007f8a92cb2d18 _sigtramp + 169299592
4 swift 0x000000010f9b9524 swift::Lowering::TypeConverter::makeConstantType(swift::SILDeclRef, bool) + 788
5 swift 0x000000010f97b1d7 swift::Lowering::TypeConverter::getConstantInfo(swift::SILDeclRef) + 183
6 swift 0x000000010fa1f848 (anonymous namespace)::AccessorBasedComponent<swift::Lowering::LogicalPathComponent>::getBaseAccessKind(swift::Lowering::SILGenFunction&, swift::AccessKind) const + 40
7 swift 0x000000010fa1dc88 drillToLastComponent(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::ManagedValue&, swift::AccessKind) + 120
8 swift 0x000000010fa1daf1 swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext) + 209
9 swift 0x000000010fa1e157 swift::Lowering::SILGenFunction::emitCopyLValueInto(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::Initialization*) + 423
10 swift 0x000000010f9f4cbc swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*) + 140
11 swift 0x000000010f9ea6b1 swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 161
12 swift 0x000000010fa34a7c swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 284
13 swift 0x000000010fa36b29 swift::Lowering::SILGenFunction::visitForEachStmt(swift::ForEachStmt*) + 1625
14 swift 0x000000010fa34a28 swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 200
15 swift 0x000000010fa37bb4 emitStmtConditionWithBodyRec(llvm::MutableArrayRef<swift::StmtConditionElement>, swift::Stmt*, llvm::ArrayRef<ConditionalBinding>, llvm::TinyPtrVector<swift::SILBasicBlock*>&, swift::Lowering::SILGenFunction&) + 2420
16 swift 0x000000010fa3559e emitStmtConditionWithBody(llvm::MutableArrayRef<swift::StmtConditionElement>, swift::Stmt*, swift::CleanupLocation, llvm::ArrayRef<ConditionalBinding>, swift::Lowering::SILGenFunction&) + 254
17 swift 0x000000010fa35089 swift::Lowering::SILGenFunction::visitIfStmt(swift::IfStmt*) + 201
18 swift 0x000000010fa34a28 swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 200
19 swift 0x000000010f9fc700 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 320
20 swift 0x000000010f9d1de6 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 246
21 swift 0x000000010f9f3e24 swift::ASTVisitor<SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 308
22 swift 0x000000010f9f287e SILGenType::emitType() + 254
23 swift 0x000000010f9ec61e swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
24 swift 0x000000010f9d3e1b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 427
25 swift 0x000000010f9d42a2 swift::SILModule::constructSIL(swift::Module*, swift::SILOptions&, swift::SourceFile*, llvm::Optional<unsigned int>, bool, bool) + 386
26 swift 0x000000010f9d43f2 swift::performSILGeneration(swift::SourceFile&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 98
27 swift 0x000000010f880591 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 3841
28 swift 0x000000010f87f4e6 main + 1814
29 libdyld.dylib 0x00007fff90b905ad start + 1

我什至重新创建了我的数据模型,以确保向后移植不会出现问题。我希望有人遇到过。这里有很多关于 Seg 11 崩溃的线程,但似乎每个实例都是不同的。

任何见解将不胜感激

最佳答案

好吧,没有任何效果,所以我创建了一个新项目,将所有源代码添加回来,并且工作正常。与其说是一个答案,不如说是一个解决方案,但我仍然不知道为什么它崩溃了。

关于xcode - Swift 1.2 编译器段错误 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31664595/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com