user768861
user768861

Reputation: 83

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) Swift

error thread photo of storyboard and the problem

I'm trying to check if a person exists for a certain date clicked on a calendar (each person has a date in the calendar associated with them), and if he doesn't a segue to a different controller. If he does I segue elsewhere. This problem arises when the person doesn't exist. I attached my code below and the problem is the performSegue in the else statement.

I'm really new to this so please explain as simply as possible! Appreciate it in advance.

func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {
        self.delegate?.dateSelected(dateStart: date)
        let person = containsHost(date: date)
        if (person != nil) {
            performSegue(withIdentifier: "planReceipt", sender: person) 
        } else { //check sender and logic
            performSegue(withIdentifier: "modal", sender: nil) //DOESN'T WORK
        }

    }

Upvotes: 1

Views: 3935

Answers (2)

Waylan Sands
Waylan Sands

Reputation: 375

Check you didn't set up your segue identifiers with uppercase "PlanReceipt" in the storyboard. I've done that before.

Upvotes: 1

Nupur Sharma
Nupur Sharma

Reputation: 1214

Please check in the storyboard. Either your segues - "planReceipt" and "createPlan" don't exist or change the sender: nil to sender: self.

Upvotes: 0

Related Questions