Posts

Post not yet marked as solved
1 Replies
311 Views
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) } } } }
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
2 Replies
411 Views
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
Posted
by y_ich.
Last updated
.
Post marked as solved
1 Replies
260 Views
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.
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
0 Replies
372 Views
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.
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
3 Replies
624 Views
Hi.I tried to use "live listen" by my beats headset but failed. It seems that "live listen" feature is enabled only for AirPods (Pro) or "made for iPhone" hearing aids.And I also tried to switch an input device to builtInMic by setPreferredInput on Swift Playgrounds.It succeeded but it also switches the output to built in speaker.Since I want to keep the output to the headset, I failed to make my own "live listen".Is "live listen" setting an private API?Or is it possible to make my own "live listen" app if I have AirPods?Thanks.
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
0 Replies
248 Views
Hi. In the sample code "Offering, Completing, and Restoring In-App Purchases "(https://developer.apple.com/documentation/storekit/in-app_purchase/offering_completing_and_restoring_in-app_purchases), there is a cleanup code in applicationWillTerminate method.func applicationWillTerminate(_ application: UIApplication) { // Remove the observer. SKPaymentQueue.default().remove(StoreObserver.shared) } But applicationWillTerminate method is not called when the app is suspended according to the document (https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate). What would happen about StoreObserver.shared if the suspended app is terminated? Thanks.
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
0 Replies
249 Views
Hi. When Catalyst was released, I understood that it consisted of two factors, compiling for Intel CPU and UIKit on macOS. So you needs to add target "Mac" and Mac.entitlements on Xcode to run your app on Catalyst. Now M1 Mac appears and it runs iPhone/iPad apps without the above compilation if they are distributed. In this case, still do iPhone/iPad apps run on Catalyst? (I mean that macOS-specific features such as UIHoverGestureRecognizer work on M1 Mac if you implement some using these features.) 2. Why don't you need Mac.entitlements? The above two questions are just what I come up with. Detail summary is welcome. Thanks
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
0 Replies
415 Views
Hi. I want to create a new UIScene when my app opens a file in some condition. So I wrote requestSceneSessionActivation in scene(_:openURLContexts:).     func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {     &#9;&#9;let options = UIScene.ActivationRequestOptions()     &#9;&#9;options.requestingScene = scene     &#9; UIApplication.shared.requestSceneSessionActivation(nil, userActivity: createUserActivity(for: url), options: options) { error in       &#9;&#9;&#9;print(debug: error)     &#9;&#9;}   &#9;}     private func createUserActivity(for url: URL) -> NSUserActivity {     &#9;&#9;let userActivity = NSUserActivity(activityType: getUserActivityType(idx: 1)!)     &#9;&#9;userActivity.requiredUserInfoKeys = ["url"]     &#9;&#9;userActivity.addUserInfoEntries(from: ["url": url])     &#9;&#9;(UIApplication.shared.delegate as? AppDelegate)?.url = url &#9;&#9;    return userActivity &#9;&#9;} But scene(_:willConnectTo:options:) gets an empty userInfo. Is it impossible to include an URL of a file in iCloud Drive in NSUserActivity#userInfo? I guess that it is not because it is a Security-Scoped URL. Is my understanding right? And if so, how can I pass a Security-Scoped URL to a scene to be created? Of course, If you make a property for it in your AppDelegate, you can do it but I think that it is not normal. Thank you in advance,
Posted
by y_ich.
Last updated
.
Post marked as solved
3 Replies
1.5k Views
Hi.I am using a local socket for inter-thread communications in my macOS app.It works well if App Sandbox is off, but does not work otherwise.What Entitlement Key enables local socket?I tried com.apple.security.network.server, com.apple.security.files.user-selected.read-only, com.apple.security.files.user-selected.read-write but failed.Thanks.
Posted
by y_ich.
Last updated
.
Post not yet marked as solved
0 Replies
454 Views
Hi.I tried predictions(from:options:) method in Core ML 2.When I applied multiple inputs, it achieved 1.5 times to 2 times faster performance.I also tried prediction(from:options:) method in mutlithreaded manner and got 2 times faster in the case of 2 inputs and 3 times faster in the case of 3 inputs.I understood that it depends on capacity of computing resources.But actually, In what case is predictions(from:options:) method in Core ML 2 more effective than multithreaded one?Could you tell me your experiences?Thanks.
Posted
by y_ich.
Last updated
.