Closed dhekrazaied closed 8 years ago
Hi, please try init by calling the designated instantiate() method instead of alloc()init()
Something like [WWCalendarTimeSelector instantiate];
same error fatal error: unexpectedly found nil while unwrapping an Optional value
Hi @dhekrazaied
Perhaps you could try this because I'm not having any issues with it (:
#import "ViewController.h"
#import <WWCalendarTimeSelector/WWCalendarTimeSelector-Swift.h>
@interface ViewController () <WWCalendarTimeSelectorProtocol>
@property (strong, nonatomic) NSDate *singleDate;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.singleDate = [NSDate new];
}
- (IBAction)openCalendar:(id)sender {
WWCalendarTimeSelector *cal = [WWCalendarTimeSelector instantiate];
cal.delegate = self;
cal.optionCurrentDate = self.singleDate;
[cal.optionStyles showDateMonth:true];
[cal.optionStyles showMonth:false];
[cal.optionStyles showYear:false ];
[cal.optionStyles showTime:false];
[cal.optionCurrentDateRange setStartDate : self.singleDate ];
[cal.optionCurrentDateRange setEndDate: self.singleDate];
[self presentViewController:cal animated:YES completion:nil];
}
- (void)WWCalendarTimeSelectorDone:(WWCalendarTimeSelector *)selector date:(NSDate *)date {
self.singleDate = date;
}
@end
I think I have a problem in the .storyboard file not in the code
Hi, please explain in detail what happens to storyboard file. I'm having no issues on my side by creating a new objective c project, and installing the library through cocoapods (:
I didn't use cocopods I just add folder and files, and I modified the target of wwcalendertimeselector.storyboard in the inspector from wwcalendertimeselector to the current project
Hi, apologies for the inconvenience. The problem (happened in another issue) was the Module in custom class. It's supposed to be empty (so that it's default), and not pointing to WWCalendarTimeSelector.
The UIViewController itself might be pointing to the same WWCalendarTimeSelector. Do delete the defined module, and it should work.
thx a lot it's work perfectly now. Best regards.
Is it chances to crash app.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"WWCalendarTimeSelector" bundle:nil];
WWCalendarTimeSelector *selector = (WWCalendarTimeSelector *)[storyboard instantiateInitialViewController];
selector.delegate = self;
[selector.optionStyles showDateMonth:YES];
[selector.optionStyles showMonth:NO];
[selector.optionStyles showYear:NO];
[selector.optionStyles showTime:NO];
selector.optionCurrentDate = leftDate;
selector.optionIdentifier = @"1";
[self presentViewController:selector animated:YES completion:nil];
thanks in advance.
when use the code with ios project with objective c and I get this error fatal error: unexpectedly found nil while unwrapping an Optional value this is my code -(IBAction)goToPickerDateTime:(id)sender{
}