Xcode: Invalid parameter not satisfying Xcode: Invalid parameter not satisfying ios ios

Xcode: Invalid parameter not satisfying


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];}


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 breakpointnavigate to breakpoint

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

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

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

Hope this help~


matomo