Skip to content

reset() causing crash #39

Description

@Michaelcraun
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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions