If you are coming here for a solution. Radar feedback was, that only with requiresExternalPower property, the cpu usage is "unlimited". I have not tried yet but wanted to share.
Post
Replies
Boosts
Views
Activity
If anyone comes here for a solution. I still believe this is a bug in DragGesture but there is workaround possible though CADisplayLink. (See here: https://developer.apple.com/documentation/quartzcore/optimizing_promotion_refresh_rates_for_iphone_13_pro_and_ipad_pro)
Unfortunately, you will have to create a helper object to setup a display link, because you can't have @objc functions in structs. I created:
@available(iOS 15.0, *)
class RefreshRateHelper {
static let shared = RefreshRateHelper()
private var displayLink:CADisplayLink? = nil
init() {
displayLink = CADisplayLink(target: self, selector: #selector(ignore))
displayLink?.add(to: .current, forMode: .default)
}
@objc
func ignore(link: CADisplayLink) {
}
func preferredFrameRateRange(_ range:CAFrameRateRange){
displayLink?.preferredFrameRateRange = range
}
}
This very hacky. It basically is a globally accessible display link that you give a preferred framerate. I ended up setting a high framerate in .updating and resetting it to .default in onEnded.
I hope this helps someone.
This was related to a "hack" to be able to change the status bar color. See here https://stackoverflow.com/questions/69280813/onopenurl-not-called-on-ios-15-simulator-swiftui .
I posted this as FB9657760
I am not sure if that other thread helps me but thanks for sharing. I filed this as FB9650676.
I just wanted to say thanks for sharing not only your problem but also approach to solution. I am currently experiencing something similar although on a smaller scale.
I am running in the background in the "heavier" BGProcessingTaskRequest. And get crashed like so:
Event: cpu usage
Action taken: Process killed
CPU: 48 seconds cpu time over 55 seconds (87% cpu average), exceeding limit of 80% cpu over 60 seconds
My current suspicion is that I am using DispatchQueue.global(qos: .background) which might look for such a limit but I am not sure about it. Also the docs specifically ask to use this queue in the background. Maybe it is something different but it would be odd to claim you can train a machine learning model in the background if you are not allowed to use more than 80% cpu over 60 seconds.
Did you ever find a solution? I just got the same by feeding an image to VNImageRequestHandler to or rather an VNGenerateAttentionBasedSaliencyImageRequest. I am on Simulator 14.5.
I just wanted to leave a reply as I just installed Public Beta 1 and Xcode Beta 12 but still, the sentenceEmbedding API is not available in my playground test. Also, it seems we are the only people who asked questions on the WWDC hashtag but no one ever answered? Not a good start for the "new" dev forums, if you ask me. :(