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

Signature is blank image on iOS 16 #62

Open
Dilshad-Noushad opened this issue Sep 21, 2022 · 9 comments
Open

Signature is blank image on iOS 16 #62

Dilshad-Noushad opened this issue Sep 21, 2022 · 9 comments

Comments

@Dilshad-Noushad
Copy link

No description provided.

@nishanega
Copy link

I'm also facing the same issue. When you try signing in iPhone 14Pro running with iOS 16.0 the signature image is being blank.

@Dilshad-Noushad
Copy link
Author

Dilshad-Noushad commented Sep 29, 2022

@nishanega I fixed the problem by using YPDrawSignatureView.

@wolfej94
Copy link

also facing this issue.

@santosaprima
Copy link

I tried updating to 3.2.0 from 2.2.0 earlier and facing the same issue. So, I reverted back to 2.2.0 and it works now

@maulikm235
Copy link

maulikm235 commented Dec 9, 2022

I found out that, this issue is with XCode not with this POD, I have tried using downloaded XCode Dmg and it works fine, but the XCode which I have downloaded from AppStore have the issue.

So try using the downloaded XCode Dmg file.

https://stackoverflow.com/questions/10335747/how-to-download-xcode-dmg-or-xip-file

@Vanyaslav
Copy link

I have analyzed the issue. And it's pointing directly to PencilKit and object PKDrawing that is not able to create an UIImage from Data object.

@pryder-fleetaero
Copy link

We encountered the issue as well and as per @Vanyaslav is appears to be caused by:

/**
    The UIImage representation of the signature. Read/write.
    */
    open var signature: UIImage? {
        get {
            canvas.drawing.image(from: bounds, scale: 1.0)
        }

        set {
            guard let data = newValue?.pngData(), let drawing = try? PKDrawing(data: data) else {
                return
            }
            canvas.drawing = drawing
        }
    }

Where I'm pretty sure PKDrawing(data: data) expects data in the format of PKDrawing.dataRepresentation(), not PNG data.

@JiajunDou
Copy link

direct way:

private func resetTool() {
	//canvas.tool = PKInkingTool(.pen, color: strokeColor.withAlphaComponent(strokeAlpha), width: maximumStrokeWidth)
	canvas.tool = PKInkingTool(.pen, color: UIColor.orange, width: maximumStrokeWidth)
    }

@bivant
Copy link

bivant commented Apr 24, 2024

We encountered the issue as well and as per @Vanyaslav is appears to be caused by:

    open var signature: UIImage? {
...
        set {
            guard let data = newValue?.pngData(), let drawing = try? PKDrawing(data: data) else {
                return
            }
            canvas.drawing = drawing
        }
    }

Where I'm pretty sure PKDrawing(data: data) expects data in the format of PKDrawing.dataRepresentation(), not PNG data.

I think this (signature restore/load from an image) can be resolved by using UIImageView below the signature drawing view and adjusting clear/undo/redo code for this case.
Custom image save/restore logic with storing drawing data in EXIF can be implemented as well, but this seems like too fragile approach.
Using LegacySwiftSignatureView in SwiftSignatureView.instance is much faster workaround, though.

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

9 participants