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

Crash when setting the badgeString #27

Open
Isuru-Nanayakkara opened this issue Jul 7, 2017 · 2 comments
Open

Crash when setting the badgeString #27

Isuru-Nanayakkara opened this issue Jul 7, 2017 · 2 comments

Comments

@Isuru-Nanayakkara
Copy link

Hi,

I installed the library through CocoaPods. Added a UIButton (just an image, no text) and set its class to MIBadgeButton. I didn't do any modifications through the IB.

Then I tried to increase the badge count every time the button is pressed. But when setting the badge string, the app crashes with a EXC_BAD_ACCESS error.

Below is my code.

import UIKit
import MIBadgeButton_Swift

class ViewController: UIViewController {

    @IBOutlet weak var button: MIBadgeButton!
    
    var count = 0
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBAction func didTapButton(_ sender: MIBadgeButton) {
        count = count + 1
        sender.badgeString = "\(count)"
    }
}

I also uploaded a demo project here.

@xuehaoze
Copy link

xuehaoze commented Sep 6, 2017

Got the same problem, solve it by programmatically create the MIBadgeButton in viewDidLoad.

@hamzaansari09
Copy link

The problem is with Custom class Module, @Isuru-Nanayakkara you didn't selected Module.
Changing the module to MIBadgeButton_Swift will solve your problem.
screen shot 2017-10-20 at 1 41 05 am

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

3 participants