Xcode: Invalid parameter not satisfying

I've find a Debug way may help you debug where is the exception occurred and may help someone to debug with exception.

  1. navigate to breakpoint navigate to breakpoint

  2. Click the add button, and choose exception Breakpoint Click the add button, and choose exception Breakpoint

  3. Add breakpoint and make exception type to Objective-C enter image description here

  4. Run the code It will stop at the line which make crash happened!

Hope this help~


You don't check if date is null, before using it, in ex.

(void)viewDidLoad {

    NSDate *storedDate = [[NSUserDefaults standardUserDefaults] 
                      objectForKey:@"DatePickerViewController.selectedDate"];

    // add this check and set
    if (storedDate == nil) {
        storedDate = [NSDate date];
    }
    // ---
    [self.datePicker setDate:storedDate animated:NO];
}