Monday, November 28, 2022
HomeiOS Developmentios - EPSignature Swift 5.x drawback / App crashes every time I...

ios – EPSignature Swift 5.x drawback / App crashes every time I need to save my signature


I am using EPSignature CocoaPods for drawing my signs. App was working until I did some changes to code and updated to newest version of xCode. Last time lib update was: July, 2018. I found some newest version on github but norhing…

Here is what is happening/ was happened when I tried to draw sign and click done button. App freezes and crashes each time I click done button.

Error xcode code (image)

Function -> getSignatureBoundsInCanvas

    open func getSignatureBoundsInCanvas() -> CGRect {
    return bezierPath.bounds
}

Function -> onTouchButton

    @objc func onTouchDoneButton() {
    if let signature = signatureView.getSignatureAsImage() {
        if switchSaveSignature.isOn {
            let docPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first
            let filePath = (docPath! as NSString).appendingPathComponent("sig.data")
            try? signatureView.saveSignature(to: URL(string: filePath)!)
        }
        signatureDelegate?.epSignature!(self, didSign: signature, boundingRect: signatureView.getSignatureBoundsInCanvas())
    } else {
        showAlert("You did not sign", andTitle: "Please draw your signature")
    }
}

App delegate error shows this

Thread 1: "-[Control.SignatureViewController epSignature:didSign:boundingRect:]: unrecognized selector sent to instance 0x10a040c00"

And when I want to jump to function ePSignature here is a code

extension SignatureViewController: EPSignatureDelegate {

func epSignature(_: EPSignatureViewController, didSign path: UIBezierPath?) {
    path?.origin = .zero
    path?.scaleToFit(size: Const.signatureSize, insets: Const.signatureInsets)
    model.signed?(path)
}

func epSignature(_: EPSignatureViewController, didCancel error: NSError) {
    model.cancelled?(error)
}

}

Thanks a lot

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments