这里是Xcode 6.4和Swift 1.2。我正在移植我用Xcode7 7/Swift2 2编写的东西。这不是很多工作,移除try/catch块并将错误vars重新添加进来。当我结束这一切时,编译器就崩溃了。日志只指向一个函数,所以我逐行注释东西。问题似乎是我在任何时候都会为我的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崩溃中有很多线程,但似乎每个实例都不同。
如有任何见解,将不胜感激。
发布于 2015-07-28 03:05:26
嗯,没有什么工作,所以我创建了一个新的项目,添加了我所有的源代码,它运行良好。与其说是一个答案,至少是一个解决办法,我仍然不知道它为什么会崩溃。
https://stackoverflow.com/questions/31664595
复制相似问题