Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset() causing crash #39

Open
Michaelcraun opened this issue Dec 19, 2017 · 0 comments
Open

reset() causing crash #39

Michaelcraun opened this issue Dec 19, 2017 · 0 comments

Comments

@Michaelcraun
Copy link

func setup() {
    addSubview(leftButton)
    addSubview(rightButton)
    addSubview(label)

    backgroundColor = buttonsBackgroundColor
    layer.cornerRadius = cornerRadius
    clipsToBounds = true

    //Commented this line out
    NotificationCenter.default.addObserver(self, selector: #selector(GMStepper.reset), name: NSNotification.Name.UIApplicationWillResignActive, object: nil)
}

Whenever the applicationWillResignActive AppDelegate function was being called, the reset() function would cause a 'found nil while unwrapping an optional value' error. Not sure why the steppers need to be reset when the application resigns, honestly. I commented the observer out and it seems to work fine. If I'm wrong in this, or there's a better way to fix this error, please do inform me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant