I’m working in a App using Swift that includes PencilKit with a “canvasview” to take notes. Everything works fine, but I can’t find the way to “convert” de value returned by canvasView.drawing to String for uploaded it and storage into a database.I can get a image and even a "base64EncodedString” but I need a way to send the “drawing” to a server and then load from it, and show in the canvasView.I have tested to convert it into a json, but I can’t “deserialize” and convert it into a “drawing” again, when is loaded from the server hehe.Thanks in advance
Post
Replies
Boosts
Views
Activity
Hi
Until iOS 14 update, in my APP PKToolPicker is show at start using this code.
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
guard
let window = view.window,
let toolPicker = PKToolPicker.shared(for: window) else { return }
toolPicker.setVisible(true, forFirstResponder: canvasView)
toolPicker.addObserver(canvasView)
canvasView.becomeFirstResponder()
}
After iOS 14 update the toolPicker is not showing, the only way to make it “shows” is add an “alert” like this, just after" canvasView.becomeFirstResponder()” in the previous code.
let alerta=UIAlertController(title: “Info example text", message:”Message info example text", preferredStyle:.alert)
let accion=UIAlertAction(title: "Aceptar", style:.default, handler:nil)
alerta.addAction(accion)
present(alerta, animated:true, completion:nil)
This is not a “great solution”. What is the best way to make the
PKToolPicker at start, just like worked before iOS 14 update.
I also try to use " let toolPicker = PKToolPicker.init()” but it only works in simulator not in real device.
Thanks in advance for any idea.
I just need to know how to detect when a openend Carplay app, is back from background to reload data.
Is there any way to detect it, like in iOS apps?
Thanks in advance ;)