Reputation: 990
I've crashed app when my app run on iOS 7
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSCalendar calendarWithIdentifier:]: unrecognized selector sent to class 0x3b67718c'
I'm using the code on my project
- (instancetype)initWithLocale:(NSLocale *)locale andFirstWeekday:(NSUInteger)firstWeekday{
if (self = [super init]){
_calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
_calendar.timeZone = [NSTimeZone localTimeZone];
_calendar.locale = locale;
_calendar.firstWeekday = firstWeekday;
}
return self;
}
Someone guy please help me to solve that problem that help me save a ton of time in my life. Thanks.
Upvotes: 0
Views: 209
Reputation: 5435
[NSCalendar calendarWithIdentifier]
is available for iOS 8+.
You can use initializer method instead, this works fine in all iOS:
_calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];
Upvotes: 2