Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
572 views
in Technique[技术] by (71.8m points)

command line - iOS app breakpoints on running

I'm an experienced developer, but new to iOS/Objective C.

The app below builds OK (modulo any typo/cut'n'paste errors). When I run it, it breaks in the print method, in a way that makes it look like there is some error. I cannot see what or where the error is. Probably a real newby error though!

Can anyone help me out by explaining what I am doing wrong and how to fix it?

This is a command line MacOS app, with Foundation, being built & run in XCode.

@interface DayOfYear : NSObject
- (void) print;
- (id) init : (int) day;
@end // DayOfYear

@implementation DayOfYear

int dayInYr =0;

- (id) init : (int) day {
    self = [super init];
    dayInYr = day;
    return self;
}

- (void) print {
     // NSLog(@"In print with %d", dayInYr);

}    // WHEN RUN THIS IS WHERE IT BREAKPOINTS SAYING "Thread 1, breakpoint 1.1, 2.1


@end

int main(int argc, const char * argv[])
{

    @autoreleasepool {

        // insert code here...
        NSLog(@"Hello, World!");

        DayOfYear *d =[[DayOfYear alloc] init : 2 ];
        [d print];


        NSLog(@"Finished!");

    }
    return 0;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have two breakpoints set on the print method. Breakpoints are shown in the left margin as blue flags. You can get rid of them by dragging them out of the margin, like this:

dragging breakpoints out to remove them


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...