Posts

Post not yet marked as solved
2 Replies
337 Views
Hi! I watched the 'Analyze hangs with Instruments' video from WWDC2023. It's such a great video! Unfortunately, I found a case that the video doesn't cover when profiling my browser app using Instruments: As shown in the image, the hangs still occur even though my main thread is not busy, and I've also used the 'Thread State Trace instrument' to confirm that the main thread is not blocked either. I'm not sure what the next step is to resolve the hangs. Any insight or guidance would be much appreciated. Thank you!"
Posted Last updated
.
Post not yet marked as solved
0 Replies
343 Views
DL;DR: Sometimes the API fails to unblock the app and leaves an hourglass shield on the restricted apps, which is not set by us. Even worse, if we remove authorization of our app from Settings, the restricted apps remain locked until we restart the phone or re-run our app from Xcode. Our app monitors the usage of selected apps from the current time until the reset time at 4:00 a.m. When the given threshold is reached, the selected apps are shielded. After the user taps the close button on the shield view, we attempt to remove the shield, set up a new threshold monitoring and close the app. The issue is that: sometimes the shield removal fails, and after the app closes itself, it remains shielded, and displays an hourglass shield view that was never in our shield configuration. Additionally, regardless of what we do-removing the shielding from our apps or removing the authorization of our app from Settings, the restricted apps remain shielded until we restart the phone or re-run our app from Xcode. Code I use for un-shielding: warningUsageStore.clearAllSettings() Code I use for scheduling the threshold: var warningMinute = userDefaults.integer(forKey: .warningMinute) if warningMinute <= 0 { warningMinute = 5 } let selection = familyActivitySelection() let now = Date.now let start = Calendar.current.dateComponents([.hour, .minute, .second], from: now) var end = AppConfig.resetEndTime // use twenty minutes later as the end time if the before reset time is too near e.g. warning start at 3:55 but reset time is 4:00 if let endDate = Calendar.current.nextDate(after: now, matching: end, matchingPolicy: .nextTime), endDate.timeIntervalSince(now) <= 15*60 { end = Calendar.current.dateComponents([.hour, .minute, .second], from: now.addingTimeInterval(20*60)) } // add inidividual event according to the hash value to dintinguish between apps. var events = [DeviceActivityEvent.Name : DeviceActivityEvent]() for application in selection.applications where application.token != nil { events[.init(application.hashValue.description)] = .init(applications: [application.token!], threshold: .init(minute: warningMinute)) } for category in selection.categories where category.token != nil { events[.init(category.hashValue.description)] = .init(categories: [category.token!], threshold: .init(minute: warningMinute)) } for webDomain in selection.webDomains where webDomain.token != nil { events[.init(webDomain.hashValue.description)] = .init(webDomains: [webDomain.token!], threshold: .init(minute: warningMinute)) } try deviceActivityCenter.startMonitoring(.usageWarning, during: .init(intervalStart: start, intervalEnd: end, repeats: false), events: events) The issue happens on my iPhone11 iOS17.1.2 Any insight would be much appreciated. Thank you!
Posted Last updated
.
Post not yet marked as solved
0 Replies
324 Views
In session wwdc2023-10194 Design dynamic Live Activities at 04:53, it mentioned that we should use 'content replace transition' for animating in and out graphic elements and text. The video shows some kind of animation combined with blurring and opacity changes. But I can't seem to find code for doing this in SwiftUI or UIKit. Does anyone know the API to achieve this? 🤔 Thank you for your help!
Posted Last updated
.