H. Kawabata
H. Kawabata

Reputation: 1

Swift: EXC_BAD_ACCESS when I access class property

EXC_BAD_ACCESS occurs when I access (read or rewrite) property of class instance.

class MyUIImageView:UIImageView {
    required init?(coder aDecoder: NSCoder) {
        fatalError()
    }
    var hand: String = ""
}
@IBOutlet weak var myInstance: MyUIImageView!
func rewrite() {
    ...
    myInstance.hand = "..."  // Error!
}
func read() {
    ...
    var tmp: String = myInstance.hand  // Error!
}

Do you know how to fix this error?

・2016/1/31

Unknown class MyUIImageView in Interface Builder was found in log, and Module field of Custom Class is "None".

Upvotes: 0

Views: 88

Answers (1)

Casey
Casey

Reputation: 6701

either myInstance isn't set or myInstance isn't a MyUIImageView

Upvotes: 1

Related Questions