iOS app breakpoints on running

 ̄綄美尐妖づ 提交于 2019-11-27 07:24:32

问题


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;
}

回答1:


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:



来源:https://stackoverflow.com/questions/14821587/ios-app-breakpoints-on-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!