Post not yet marked as solved
After testing iOS16, I've found a serious bug that make all apps with PencilKit (Prodrafts, InDraft, Pencil it in, Paint...) completely useless:
If a canvasView is scrolled, all existing strokes will be shifted while writing with Apple Pencil.
After writing, all strokes will be shifted back to its positions but it make users unable to write anything.
This bug is also occurs in the example app of PencilKit: https://developer.apple.com/documentation/pencilkit/drawing_with_pencilkit
It's easy to reprocedure: Run the example app, open a note, scroll down, then write something. You will see the bug (this bug only happens in iOS 16 and iPadOS 16).
I have sent multiple bug reports since the first days of the beta, none of them are answered. It's been 2 beta versions and the bug has not been fixed yet.
I'm an indie developer and I have worked with my app for 2 years - full time - 12 hours a day - no weekend. The main feature of my app is taking note with Apple Pencil and this bug made my app completely broken. I'm terrifying that 2 years of my work will be wasted.
Please answer me, give me hope. Thank you :(
Post not yet marked as solved
For context: I'm working on a score pad app, with the ability to have a column of PKCanvases, so you can just hand write things without them being scribbled into text. As part of my stress testing, I basically filled the grid with ~50 canvases, and it seems that after a certain amount of CanvasViews are added to the score pad, my M1 iPad Pro GPU is unable to keep up.
Occasionally, a cell will just entirely render as magenta, and I will have dozens and dozens of
Execution of the command buffer was aborted due to an error during execution. Insufficient Memory (IOAF code 8) logs thrown to the console.
I honestly don't know where to go from here. I recognize that what I'm doing is almost definitely not what PencilKit was designed for, but I also know the API is relatively young. I can't tell if this is a bug that should be fixed by Apple, or entirely my fault and a sign that I need to redo the entire thing.
I've attached a screenshot with the magenta cell, there's also another two cells where the pencil strokes are just thick black squares. I'd appreciate any advice or help, I can't even seem to find any way to detect and recover from this in my code, as trying to search for Metal errors gives me discussions about writing Metal apps, which this isn't. It's a pure SwiftUI app with some PencilKit canvases.
Post not yet marked as solved
Years ago I used to use the Apple Pencil to play pubg. I used to move with my left hand and use the pencil in my right to control the view and shoot. I played today for the first time in a while and the pencil no longer works if my hand is already using the left side. Please tell me there’s a fix for this!!
Post not yet marked as solved
I am trying to use the PencilKit to build a note App. One of the issue I had was that if I use the lasso tool to select and copy a stroke, and pasted the stroke that I copied, the lasso tool focuses on the original stroke instead of the newly pasted one. Wondering if anyone have the same issue, and how can I solve it?
I uploaded a demo git in stack overflow
Post not yet marked as solved
I am trying to develop an app that enables calligraphers to use their Apple Pencil as a calligraphy pen.
The problem I am facing is that I don't know how to customize the strokes drawn by the Apple Pencil using the PencilKit framework.
I also tried to use UIKit and handle the touches by Apple Pencil, but I am not sure how to achieve the desired effect.
Can anyone guide me to solve this issue?
Post not yet marked as solved
I'm currently using PencilKit in an app that is forced to run in dark mode (UIUserInterfaceStyle == Dark in Info.plist).
But for one UIViewController only, I'm using the light mode for note taking with PencilKit. I change the ToolPicker style by using toolPicker.overrideUserInterfaceStyle = .light and it works great that way.
Unfortunately, if I want a custom color and I tap on the ColorPicker icon, it seems to still be in dark mode, because when I choose white, it draws black, and if I choose black, it draws black. This doesn't happen if I tap the black color in the predefined palette (not the color picker).
Any idea how to force to color picker to respect the tool picker userInterfaceStyle?
Post not yet marked as solved
In the recent WWDC 2022, FreeForm app was introduced and in that app in the tool picker there was a Fill Tool.
I want to put that fill tool (or any similar filling tool) in my xcode app that I am building. But when I use pencilkit PKToolPicker, there is not Fill Tool.
So how to get this fill tool in my app.
Any leads would be helpful. Thanks.
Post not yet marked as solved
I want to create a flood fill (aka paint bucket) tool with PencilKit.
I am aware of the way to inspect the PKStrokes to identify an enclosed space to fill inside of them but I'm not sure the way to create the internal shape inside that space.
Any suggestion or leads would be appreciated. Thanks in advance and please have a beautiful day.
Post not yet marked as solved
I connected my pencil to charge but the number didn’t change even after a while. I forget/reconnect it, and the battery was full (it was 34% before).
Why did that happen?
Post not yet marked as solved
Hi everyone, i have two questions about pencil 2 that how many language does it support using scribble? At the present, i know it supports english and japanese. The second quesion is... How long can its battery use in once full charge?
Thanks
Post not yet marked as solved
Hi,
can i create custom tool for PKToolPicker?
On documentation page on PKTool says "Don’t adopt this protocol in your own objects. Instead, create a tool object to provide users with the desired the tool behavior."
Best regards,
Matej Klemen
Post not yet marked as solved
In the sample project "Drawing with PencilKit", even scrolling by 1 pixel can cause my iPad Pro to use 167% CPU and keep this usage for 2-5 seconds. My iPad got too hot after few minutes that I can't barely put my palm on it.
This a serious problem and could be reprocedure easily:
Run the sample "Drawing with PencilKit" on your iPad
Open the sample note
Select all strokes in the note and duplicate about 7 times (it is just an average number of strokes I write in a page on a note-taking app like GoodNotes).
Scroll and watch the CPU usage jumps in Xcode
It is not matter how long you scroll or how many strokes are visible on the screen. If the drawing has that much strokes, the CoreHandwriting objects will eat all the CPU.
I hope it got fixed soon because it make apps with PencilKit consume too much baterry, getting too hot and we receive many bad review because of it :(
Many thank to Pencil and Paperteam for developing this Framework btw, this framework is awesome, but it could be better, I believe.
Post not yet marked as solved
i read year old post here https://developer.apple.com/forums/thread/650386?answerId=628394022#reply-to-this-question , where it is said it's not available for everyone right now.
does anyone have any info about this when snap to Shape and writing to text might be available for every one ?
Post not yet marked as solved
Seeing an issue with 15.5 beta 3, where the Apple Pencil disconnects from the iPad Pro 3rd gen when the iPad is also connected to the Magic Keyboard. Once I disconnect the keyboard the Apple Pencil works again. Anyone else seeing this?
Post not yet marked as solved
Tried to ask as a comment in the other thread:
https://developer.apple.com/forums/thread/650386?answerId=628394022#reply-to-this-question
But can't leave a comment in there for some reason (the thread is locked?). Asking exactly the same question, now for iOS 15. Anything changed in this area?
When selecting a stroke path for object on PKCanvas, the option "Snap to Shape" appears.
I understand this function is still in beta and has not made available natively to other PencilKit app. Is there a way using Stroke API to call this function directly after the user hold pencil for half a second when stroke is done drawing, just like how it behaves in native apps?
Post not yet marked as solved
When I use pencil or highlighter of PencilKit on debug, and write it quickly, it'll crash. But it's fine on release
the error message:
-[MTLDebugCommandBuffer lockPurgeableObjects]:2103: failed assertion `MTLResource 0x2816cd0a0 (label: (null)), referenced in cmd buffer 0x11a041400 (label: Live rendering command buffer) is in volatile or empty purgeable state at commit'
is it a bug, or am I making something wrong?
Post not yet marked as solved
I am building a PencilKit app that interprets a canvasView.drawing's size. Drawings below a certain size are interpreted as tap gestures and get cleared in the interpretation process.
Effectively, I am doing it like this:
func canvasViewDrawingDidChange(_ canvasView: PKCanvasView) {
// Check if drawing is empty,
// otherwise this would loop
guard !canvasView.drawing.bounds.isEmpty
else {
return
}
if canvasView.drawing.bounds.width 10 &&
canvasView.drawing.bounds.height 10
{
canvasView.drawing = PKDrawing()
handleDetectedTapGesture()
}
}
On my 2020 iPad Pro, this works flawlessly. On other iPads however, I observe a strange behaviour:
In a series of drawing little specks on the canvas that are all supposed to be cleared immediately, sometimes the canvas seems to not be cleared, a single speck stays visible. After I draw the next speck somewhere else, the clearing is functional again, which means the canvas was internally emptied, the visible state was just not up-to-date.
Finger input on the canvas is deactivated. The canvas tool is set to pencil, width 5.0.
Does anybody have an idea what could be the reason for this behaviour?
Post not yet marked as solved
Every time I resize the PKCanvasView on a button tap, PKCanvasView, sometimes a few strokes later, sometimes on the first stroke after resize, removes all strokes except the one currently being drawn & this happens as soon as I start to draw. Then, when I lift the pencil up & away from screen, all previous strokes become visible except the one I just drew. And then, on the very next stroke, the drawing is updated correctly, with all strokes correctly visible.
This is how I update the view when it's resized:
UIView.animate(withDuration: 0.3, animations: {
self.descriptionPane.isHidden = self.canvasToggle.isSelected
(self.descriptionPane.superview as! UIStackView).layoutIfNeeded()
self.currentMaxZoomScale = self.canvasToggle.isSelected ? (self.canvasView.bounds.width / oldCanvasRect.width) : 1
self.canvasView.maximumZoomScale = self.currentMaxZoomScale
self.canvasView.setZoomScale(self.currentMaxZoomScale, animated: false)
self.canvasView.setContentOffset(CGPoint(x: 0,y: 0), animated: false)
}, completion: { isComplete in
self.canvasToggle.isUserInteractionEnabled = true
self.canvasView.isUserInteractionEnabled = true
})
I more often than not see the following warning when I this problem occurs.
[Stroke Generator] Missed updates at end of stroke: 2 (total points: 69)
Could anyone guide me on how I should approach this problem?
Is it even a good idea to resize the canvas?
Post not yet marked as solved
I am starting to work with PencilKit and have a small sample app set up with Swift. When I draw a line too long it will crash from com.apple.pencilkit.renderer with the following:
-[MTLDebugCommandBuffer lockPurgeableObjects]:2103: failed assertion `MTLResource 0x280584a10 (label: (null)), referenced in cmd buffer 0x107019400 (label: Live rendering command buffer) is in volatile or empty purgeable state at commit'
I can draw lots of small lines without issue. Doesn't seem to matter what size the canvas is or any other specific attributes I can determine. It's a quick sample so there's really not much going on, and this appears to be coming from pencil kit and metal under the hood.
I am using an iPad pro, iOS 15.1 and a pencil2 and using finger to draw with the same crash if it helps.
Post not yet marked as solved
For some reasons I am unable to set PKInk color to black.
It works with yellow, red, blue, …but black is just ignored and I get the stroke in white.
This is really weird and I don’t know why.
I tried by setting black to PKInkingTool and even by creating a stroke manually and set the PKInk color to black.
Do you have an idea?
Thanks.