IOS app breakpoints at startup
I am an experienced developer but new to iOS / Objective C.
The application below builds OK (mod any typo / cut'n'paste errors). When I run it, it breaks in the print method, which makes it look like some kind of bug. I don't see what and where is the error. Probably a real new bug though!
Can anyone help me explain what I am doing wrong and how to fix it?
This is a command line macOS application with Foundation that is built and 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;
}
+3
source to share