“Thread 1: stopped at breakpoint” error when initi

2018-12-31 22:56发布

I am following the Stanford University iOS development course on iTunes U.

In one of the demos (that I have been trying to follow), there is this code that loads the property list from an NSURL and returns it as NSMutableDictionary.

-(NSMutableDictionary *) words
{

    NSURL *wordsURL=[NSURL URLWithString:@"http://cs193p.stanford.edu/vocabwords.txt"];

    words=[[NSMutableDictionary dictionaryWithContentsOfURL:wordsURL] retain];


    return words;
}

The application is successfully built, but at runtime it gives the following error and gets stuck:

Screenshot of Xcode stopped at a breakpoint

I can't figure out what the problem is. Can you please help?

3条回答
忆尘夕之涩
2楼-- · 2018-12-31 23:25

You're stopped at a breakpoint. That's a debugging tool, not an error. See the blue arrow/tab in the left margin, where the line numbers are? Drag that away and drop it anywhere (you'll see a "poof") to remove it, then run your project again.

You can also deactivate all breakpoints by typing -Y, the key equivalent for the menu item Debug>Deactivate Breakpoints, or you can view all your breakpoints in the Breakpoint Navigator (hit -6).

When execution stops like this, you can continue from the breakpoint, either by typing continue at the debugger prompt in the Console:

(lldb) continue

Or hitting the "Play" button in the debugger controls. You can also type Control--Y, which is the equivalent for the menu item Debug>Continue.

enter image description here

查看更多
泛滥B
3楼-- · 2018-12-31 23:26

The program is stopping because you have a breakpoint.. That's the blue arrow on the left of the code. Right-click it and delete.

查看更多
弹指情弦暗扣
4楼-- · 2018-12-31 23:27

This isn't an error. You just set a breakpoint (probably without knowing it).

Drag the little blue Chevron in the column at the left out of the way. You will see it disappear and go poof, and then you can rebuild your app and you should see it run properly.

Now, that said, I think there are some memory management mistakes in your code, but we can return to those later. ;-)

查看更多
登录 后发表回答