I am new to objective-c. My object reportingTime is nil in init method. What I am doing wrong ? How can I initialize reportingTime and set firstweekday ?
I have the following interface and implementation
My interface file Calculation.h
@interface Calculate : NSObject {
NSCalendar *reportingTime;
....
....
}
@property NSCalendar *reportingTime;
@end
And my implementation file Calculate.m
#import "Calculate.h"
@implementation Calculate
@synthesize reportingTime;
- (id)init
{
if(self = [super init]) {
reportingTime = [[NSCalendar alloc] init];
[reportingTime setFirstWeekday:1];
// reportingTime is nil ??????
}
return self;
}