Post

Replies

Boosts

Views

Activity

Banner of local notification from broadcast upload extension may not work.
Hi. I implemented a broadcast upload extension and it requests local notifications. The local notification works normally on broadcastStarted(withSetupInfo:), but the Banner of the local notification does not work on processSampleBuffer(_: with:) though its Notification Center works normally. What am I missing? Here is my code snippets. container app class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. requestAuthorization() ... } private func requestAuthorization() { let center = UNUserNotificationCenter.current() center.requestAuthorization(options: [.alert]) { granted, error in if let error = error { // Handle the error here. print(error) } if granted == true { center.delegate = self center.getNotificationSettings(completionHandler: { setting in print(setting) }) } else { print("not permitted") } } } } upload extension class SampleHandler: RPBroadcastSampleHandler { override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) { super.broadcastStarted(withSetupInfo: setupInfo) notification(title: "Upload Extension", body: "broadcastStarted") ... } override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) { super.processSampleBuffer(sampleBuffer, with: sampleBufferType) ... if some condition { notification(title: "Upload Extension", body: "processSampleBuffer") } } private func notification(title: String, body: String) { let content = UNMutableNotificationContent() content.title = title content.body = body let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil) let notificationCenter = UNUserNotificationCenter.current() notificationCenter.add(request) { error in if error != nil { print(error) } } } }
3
0
2.5k
Jun ’23
How can I implement a template selection via creating a new document using DocumentGroup?
Hi. I want to implement a template selection such as Pages and Numbers. Currently I am using DocumentGroup scene on SwiftUI. How can I implement it? init( newDocument: @autoclosure @escaping () -> Document, @ViewBuilder editor: @escaping (FileDocumentConfiguration<Document>) -> Content ) The initializer of DocumentGroup may suggest that the newDocument argument should open template selector and return one when the selector is closed. But I think that it may beome a complicated implementation. What is a right way to implement the template selector?
1
0
584
Aug ’23
How does UIScene know whether it has the main key window and when it changes on iPad's multi-scene?
Hi. I know to know which window gets hardware keyboard events (such as shortcut key) currently on iPad. Until iPadOS 15.0, UIApplication.shared.keyWindow, which was deprecated on iPadOS 13.0 and didBecomeKeyNotification/didResignKeyNotification. But after iPadOS 15.0, a keyWindow is managed by UIScene, not by UIApplication. Each scene of my app always has just one window. For my purpose, checking deprecated UIApplication.shared.keyWindow is still effective but didBecomeKeyNotification and didResignKeyNotification don't work because they are fired when a change happens only inside the scene. So my questions are, What is the new alternative of UIApplication.shared.keyWindow? I know a wrong hack like UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first?.windows.filter { $0.isKeyWindow }.first does not work since the order of connectedScenes is not related with getting hardware keyboard events. What are the new alternatives of didBecomeKeyNotification/didResignKeyNotification which work on inter-scene? The second question is more crucial. Because about the first question, I can still use deprecated UIApplication.shared.keyWindow. Thanks.
Topic: UI Frameworks SubTopic: General Tags:
0
0
261
Feb ’25
How can I run MPSGraph with float16?
Hi. I am implementing some neural network model by MPSGraph on Radeon Mac. I want to accelerate it by float16 since Radeon can execute kernels with float16 twice faster than float32. Is it possible? I mean, does MPSGraph support native float16 on Radeon GPU? If so, how can I do it? Setting all datatypes to float16? Thanks.
1
0
999
Oct ’21
How do we use the computational power of A17 Pro Neural Engine?
Hi. A17 Pro Neural Engine has 35 TOPS computational power. But many third-party benchmarks and articles suggest that it has a little more power than A16 Bionic. Some references are, Geekbench ML Core ML performance benchmark, 2023 edition How do we use the maximum power of A17 Pro Neural Engine? For example, I guess that logical devices of ANE on A17 Pro may be two, not one, so we may need to instantiate two Core ML models simultaneously for the purpose. Please let me know any technical hints.
1
0
2.7k
May ’24
preventsApplicationTerminationWhenModal for Mac Catalyst or iPad app on M1 Mac
Hi. I want my iPad app to run Intel/M1 Mac. I tried Mac Catalyst and it seems work basically. But I want the app to enable to close a window even if it has opened a modal. NSWindow has "preventsApplicationTerminationWhenModal" property. Are there any alternatives for Mac Catalyst or iPad app on M1 Mac? Thanks.
Replies
2
Boosts
0
Views
924
Activity
Jul ’21
Banner of local notification from broadcast upload extension may not work.
Hi. I implemented a broadcast upload extension and it requests local notifications. The local notification works normally on broadcastStarted(withSetupInfo:), but the Banner of the local notification does not work on processSampleBuffer(_: with:) though its Notification Center works normally. What am I missing? Here is my code snippets. container app class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. requestAuthorization() ... } private func requestAuthorization() { let center = UNUserNotificationCenter.current() center.requestAuthorization(options: [.alert]) { granted, error in if let error = error { // Handle the error here. print(error) } if granted == true { center.delegate = self center.getNotificationSettings(completionHandler: { setting in print(setting) }) } else { print("not permitted") } } } } upload extension class SampleHandler: RPBroadcastSampleHandler { override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) { super.broadcastStarted(withSetupInfo: setupInfo) notification(title: "Upload Extension", body: "broadcastStarted") ... } override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) { super.processSampleBuffer(sampleBuffer, with: sampleBufferType) ... if some condition { notification(title: "Upload Extension", body: "processSampleBuffer") } } private func notification(title: String, body: String) { let content = UNMutableNotificationContent() content.title = title content.body = body let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil) let notificationCenter = UNUserNotificationCenter.current() notificationCenter.add(request) { error in if error != nil { print(error) } } } }
Replies
3
Boosts
0
Views
2.5k
Activity
Jun ’23
How can I change the device on preview of storyboard in Xcode 13.4.1?
Hi. I could have changed the device on the preview of storyboard in previous Xcode via its bottom toolbar easily. But now I cannot do it. How can I change it?
Replies
0
Boosts
0
Views
849
Activity
Aug ’22
Are isKeyWindow property and didBecomeKeyNotification event deprecated?
Hi. I know that UIApplication#keyWindow is deprecated since iOS/iPadOS 13.0. But now (iOS/iPadOS 16.5), UIWindow#isKeyWindow and didBecomeKeyNotification seem deprecated, too. isKeyWindow is always true and didBecomeKeyNotification is never triggered. Is my understanding right? And if so, since what version of iOS/iPadOS are they deprecated?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
2
Boosts
0
Views
800
Activity
Jun ’23
How can I implement a template selection via creating a new document using DocumentGroup?
Hi. I want to implement a template selection such as Pages and Numbers. Currently I am using DocumentGroup scene on SwiftUI. How can I implement it? init( newDocument: @autoclosure @escaping () -> Document, @ViewBuilder editor: @escaping (FileDocumentConfiguration<Document>) -> Content ) The initializer of DocumentGroup may suggest that the newDocument argument should open template selector and return one when the selector is closed. But I think that it may beome a complicated implementation. What is a right way to implement the template selector?
Replies
1
Boosts
0
Views
584
Activity
Aug ’23
Xcode consumes large power even in idle state. How can I avoid it?
Hi. I am using Xcode 15.0.1. Even when idle, Xcode consumes a lot of power. I guess that something is wrong. How can I avoid it?
Replies
0
Boosts
0
Views
444
Activity
Nov ’23
How can I execute unit test on release build?
Hi. I am measuring performances of methods in unit test on Xcode. Measuring performances on release build is important since you can know if a performance issue will be solved by compiler or not. However, when you specify its build as release, you cannot use @testable. Please tell me any manners. Thanks.
Replies
0
Boosts
0
Views
601
Activity
Feb ’24
How does UIScene know whether it has the main key window and when it changes on iPad's multi-scene?
Hi. I know to know which window gets hardware keyboard events (such as shortcut key) currently on iPad. Until iPadOS 15.0, UIApplication.shared.keyWindow, which was deprecated on iPadOS 13.0 and didBecomeKeyNotification/didResignKeyNotification. But after iPadOS 15.0, a keyWindow is managed by UIScene, not by UIApplication. Each scene of my app always has just one window. For my purpose, checking deprecated UIApplication.shared.keyWindow is still effective but didBecomeKeyNotification and didResignKeyNotification don't work because they are fired when a change happens only inside the scene. So my questions are, What is the new alternative of UIApplication.shared.keyWindow? I know a wrong hack like UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first?.windows.filter { $0.isKeyWindow }.first does not work since the order of connectedScenes is not related with getting hardware keyboard events. What are the new alternatives of didBecomeKeyNotification/didResignKeyNotification which work on inter-scene? The second question is more crucial. Because about the first question, I can still use deprecated UIApplication.shared.keyWindow. Thanks.
Topic: UI Frameworks SubTopic: General Tags:
Replies
0
Boosts
0
Views
261
Activity
Feb ’25
How can I run MPSGraph with float16?
Hi. I am implementing some neural network model by MPSGraph on Radeon Mac. I want to accelerate it by float16 since Radeon can execute kernels with float16 twice faster than float32. Is it possible? I mean, does MPSGraph support native float16 on Radeon GPU? If so, how can I do it? Setting all datatypes to float16? Thanks.
Replies
1
Boosts
0
Views
999
Activity
Oct ’21
How can I provide Swift Playgrounds subscription server?
Hi. I want to make my Playground Book public. How can I prepare and provide Swift Playgrounds subscription server? Thanks.
Replies
1
Boosts
0
Views
877
Activity
Dec ’23
Are there any Conditional operators in vDSP?
Hi. I want to implement the code below using vDSP. for i in a.indices { a[i] = n[i] == 0.0 ? 0.0 : b[i] / n[i] } This code is slow. Are there any good implementation using Accelerate framework?
Replies
4
Boosts
0
Views
1.1k
Activity
Feb ’24
How can I avoid "Context leak detected, CoreAnalytics returned false" when using MPSGraph?
Hi. Excuse me for no reprodcution code. My app on macOS Monterey runs MPSGraph#run repeatedly. For a minutes, Xcode console shows "Context leak detected, CoreAnalytics returned false" repeatedly and the system slows down. Do I need to release some resource for each calling of run method? Thanks
Replies
2
Boosts
1
Views
2.4k
Activity
Nov ’21
How do we use the computational power of A17 Pro Neural Engine?
Hi. A17 Pro Neural Engine has 35 TOPS computational power. But many third-party benchmarks and articles suggest that it has a little more power than A16 Bionic. Some references are, Geekbench ML Core ML performance benchmark, 2023 edition How do we use the maximum power of A17 Pro Neural Engine? For example, I guess that logical devices of ANE on A17 Pro may be two, not one, so we may need to instantiate two Core ML models simultaneously for the purpose. Please let me know any technical hints.
Replies
1
Boosts
0
Views
2.7k
Activity
May ’24