zis*_*oft 10 debugging xcode core-data swift
使用Swift的XCode 6 Beta 3.
在我的应用程序中,我使用CoreData.当我在模拟器中运行我的应用程序时,XCode会弹出调试器,并在CoreData库中的某处设置断点(参见屏幕截图).这在多个CoreData函数上发生,例如在插入新记录或从实体获取记录时.断点位置始终相同.

这非常烦人.当我的应用程序从实体中获取10条记录时,我必须按下继续程序执行按钮10次.
由于此断点设置在机器代码的某处,因此断点检查器不会显示任何断点,因此我无法删除它.
有谁知道怎么摆脱它?
非常感谢.
编辑: backtrace-output:
(LLDB)BT*线#1:TID = 0x1d68b0,0x000000010a2f7fcd libswift_stdlib_core.dylib
swift_dynamicCastClassUnconditional + 77, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0) * frame #0: 0x000000010a2f7fcd libswift_stdlib_core.dylibswift_dynamicCastClassUnconditional + 77帧#1:0x000000010a0fbb85 GPS轨道GPS_Track.TrackListTableViewController.tableView (tableView=<unavailable>)(Swift.ImplicitlyUnwrappedOptional<ObjectiveC.UITableView>, cellForRowAtIndexPath : Swift.ImplicitlyUnwrappedOptional<ObjectiveC.NSIndexPath>) -> Swift.Optional<ObjectiveC.UITableViewCell> + 1125 at TrackListTableViewController.swift:53 frame #2: 0x000000010a0fc937 GPS Track@objc GPS_Track.TrackListTableViewController.tableView(GPS_Track.TrackListTableViewController)(Swift.ImplicitlyUnwrappedOptional,的cellForRowAtIndexPath:Swift.ImplicitlyUnwrappedOptional) - > Swift.Optional + 87在TrackListTableViewController.swift:0帧#3:0x000000010bc2f218 UIKit-[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 508 frame #4: 0x000000010bc0f340 UIKit- [UITableView _updateVisibleCellsNow:isRecursive:] + 2845帧#5:0x000000010bc24fea UIKit-[UITableView layoutSubviews] + 213 frame #6: 0x000000010bbb1ebd UIKit- [UIView(CALayerDelegate)layoutSublayersOfLayer:] + 519帧#7: 0x000000010b9c9598 QuartzCore-[CALayer layoutSublayers] + 150 frame #8: 0x000000010b9be1be QuartzCoreCA ::层:: layout_if_needed(CA ::交易*)+ 380帧#9:0x000000010b9be02e QuartzCoreCA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24 frame #10: 0x000000010b92cf16 QuartzCoreCA ::上下文:: commit_transaction(CA ::交易*)+ 242帧#11:0x000000010b92e022 QuartzCoreCA::Transaction::commit() + 390 frame #12: 0x000000010b92e68d QuartzCoreCA ::交易:: observer_callback(__ CFRunLoopObserver*,无符号长,无效*)+ 89帧#13:0x000000010ab52927的CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 frame #14: 0x000000010ab52880 CoreFoundation__CFRunLoopDoObservers + 368帧#15:0x000000010ab480d3 CoreFoundation__CFRunLoopRun + 1123 frame #16: 0x000000010ab47a06 CoreFoundationCFRunLoopRunSpecific + 470帧#17:0x000000010e9e9abf GraphicsServicesGSEventRunModal + 161 frame #18: 0x000000010bb39cf8 UIKitUIApplicationMain + 1282帧#19:0x000000010a0e6a5d GPS跟踪top_level_code + 77 at AppDelegate.swift:36 frame #20: 0x000000010a0e6a9a GPS Track主要+ 42在AppDelegate.swift:0帧#21:0x000000010d2e7145 libdyld.dylib`start + 1(lldb)
我进一步跟踪它:只有在为实体使用自定义对象类时才会出现问题.例:
// User class, defined in User.swift
class User: NSManagedObject {
@NSManaged var name: String
@NSManaged var firstname: String
}
// --------------
// code somewhere else
let users = moc.executeFetchRequest(fetchRequest, error: &error)
for object in users {
let user = object as User // <-- breakpoint fired here
println(user.name)
}
}
Run Code Online (Sandbox Code Playgroud)
解:
需要使用@objc指令使Objective C对自定义对象类可见:
// User class, defined in User.swift
@objc(User) // <-- required!
class User: NSManagedObject {
@NSManaged var name: String
@NSManaged var firstname: String
}
Run Code Online (Sandbox Code Playgroud)
感谢大家的帮助!
| 归档时间: |
|
| 查看次数: |
4658 次 |
| 最近记录: |