Swift 1.2编译器seg fault 11

时间:2015-07-27 22:46:15

标签: xcode swift

这是Xcode 6.4和Swift 1.2。我正在移植我在Xcode7 / Swift2中编写的东西。这不是很多工作,删除try / catch块并重新添加错误变量。当我完成所有操作时,编译器崩溃了。日志只指向一个函数,所以我逐行评论。问题似乎是我在NSManagedObject类中分配或读取一个名为Favorites的值。

例如:

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崩溃中有很多线程,但似乎每个实例都不同。

任何见解都将受到赞赏

1 个答案:

答案 0 :(得分:1)

嗯,没有任何工作,所以我创建了一个新项目,将我的所有源代码添加回来并且工作正常。至少是一个答案而不是解决方案,我仍然不知道为什么会崩溃。