【问题标题】:Breakpoint-only error with managed objects托管对象的仅断点错误
【发布时间】:2012-02-08 23:39:07
【问题描述】:

尝试在 Xcode 4.2 中调试我的程序时,我打开了断点,并在位于我的 AppDelegate.m 文件中的这段代码中发现了一个问题。

#pragma mark -
#pragma mark Core Data stack

/**
 Returns the managed object context for the application.
 If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
 */
- (NSManagedObjectContext *)managedObjectContext {

    if (managedObjectContext_ != nil) {
        return managedObjectContext_;
    }

    NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
    if (coordinator != nil) {
        managedObjectContext_ = [[NSManagedObjectContext alloc] init];
        [managedObjectContext_ setPersistentStoreCoordinator:coordinator];
    }
    return managedObjectContext_;
}

if (managedObjectContext_ != nil) {

Xcode 告诉我“线程 1:在断点 # 停止”并拒绝完成我的程序的编译。但是,如果我关闭断点并正常运行我的程序,它就可以正常工作。有谁知道为什么会这样?在此先感谢:)

【问题讨论】:

    标签: objective-c xcode4 breakpoints


    【解决方案1】:

    断点正在做它们应该做的事情,即停止程序,以便您可以检查变量值并修复错误。按下大致类似于|> 的按钮将使其恢复执行。

    【讨论】:

    • 是的,这就是我感到困惑的原因。如果我打开断点它会起作用,但如果我打开断点它就不起作用......
    • 不编译,还是不运行?
    • 它编译但不运行。在 iPhone 模拟器中,应用程序启动,但屏幕仍然黑屏。
    • 按下 |> 后会发生什么?
    猜你喜欢
    • 2012-09-30
    • 2014-08-10
    • 2014-06-05
    • 1970-01-01
    • 1970-01-01
    • 2015-02-26
    • 1970-01-01
    • 2018-03-19
    • 1970-01-01
    相关资源
    最近更新 更多