Post

Replies

Boosts

Views

Activity

crash with simple simd code in Swift
I'm struggling to get an app working on Catalina 10.15.2 using Xcode 11.3.1, Swift 5. I could manage to boil down an example of the crash for Xcode Playgrounds:import Cocoa import simd var viewMatrix = double4x4(1) var modelMatrix = double4x4(1) let modelViewMatrix = viewMatrix * modelMatrix var m = modelViewMatrix.transpose.inverse print(m)I get anerror: Execution was interrupted, reason: EXC_BAD_ACCESS (code=EXC_I386_GPFLT).like in the full app. Any idea what's wrong and why the code it crashing? App code works fine running natively on macOS 10.14.6 and iOS 13.Thanks!
29
0
5.2k
Jan ’20
withThrowingTaskGroup - (un)expected progress behavior?
I'm trying to use the new structured concurrency features of Swift 5.5 to update some code in a larger App that has been written using GCD. One routine is loading parts of a dataset in a parallel loop and I would like to convert this code using withThrowingTaskGroup while keeping a progress counter. The code compiles, runs, but does not update the progress in a way I expected: var progressCounter = 0 let count = 500 try await withThrowingTaskGroup(of: Void.self) { group in for idx in 0..<count { _ = group.addTaskUnlessCancelled { // some IO } } for try await _ in group { progressCounter += 1 } } The for try await loop is executed after all 500 task have been run and finished (iOS 15 Beta 5). I was under the impression, the for try await loop would be run in parallel to the tasks, collecting results as they come in and thereby updating the progress counter. Clearly I'm missing something or is this expected? Is withThrowingTaskGroup not the right tool for this? Any insight would be appreciated.
2
0
1k
Aug ’21
NSNetService is deprecated, how to advertise network service that is written using non-Apple API?
I’m, using NSNetService in macOS & iOS to advertise a network service that is written in a cross-platform way using C++. Using the new Network framework, advertising via NWListener.Service seems only possible if the network interface is also written using NWListener. How can I advertise my network service via Bonjour without using the now deprecated NSNetService? Thanks for any advise.
2
0
1.2k
Sep ’21
App with camera access crashes when launched from Finder but runs from Terminal
An App running on macOS Monterey 12.2.1 crashes when trying to access the camera with the following error report: Termination Reason: Namespace TCC, Code 0 This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an com.apple.security.device.camera key with a string value explaining to the user how the app uses this data. The App's Info.plist contains a NSCameraUsageDescription key plus description. Also it asks the user for permission and works fine when run from the Terminal. It only crashes when launched via Finder or Dock. The App is not signed nor hardened and thus has no entitlements. Did something change? The App worked fine before. Many thanks for any hints.
5
0
3.4k
Feb ’22