Posts

Post not yet marked as solved
0 Replies
849 Views
I am trying to run an iOS project as a Mac app on my M1 Mac Book Pro. It builds fine, but refuses to launch with an error that reads: "The LaunchServices launcher has returned an error. Please check the system logs for the underlying cause of the error." The details of the error start out: "Could not launch “” Domain: IDELaunchErrorDomain Code: 20 Recovery Suggestion: The LaunchServices launcher has returned an error. Please check the system logs for the underlying cause of the error. User Info: { DVTErrorCreationDateKey = "2022-08-03 16:08:24 +0000"; DVTRadarComponentKey = 968756; IDERunOperationFailingWorker = IDELaunchServicesLauncher; } The operation couldn’t be completed. Launch failed. Domain: RBSRequestErrorDomain Code: 5 Failure Reason: Launch failed. Launchd job spawn failed Domain: NSPOSIXErrorDomain Code: 153 " I have gotten this error in both Xcode 13.3.1 and in the last three Xcode 14.0 betas (3, 4 & 5). The project runs fine in the iPhone simulator in all cases. I have tried rebooting the Mac to see if that would clear out bad caches. That didn't help. This is very strange because I successfully ran this iOS project as an Apple Silicon Mac app about a month ago. I even tried resetting the project to remove the few minor changes I made to it back to when it successfully ran as a Mac app. Anybody know what's going on here and how to fix it?
Posted
by dsbirch.
Last updated
.
Post not yet marked as solved
0 Replies
479 Views
Is there a programmatic means of getting an iPhone camera lens' magnification level? I'm referring to the .5x, 1x and 2.x/2.5x/3.x values for the ultra wide, wide and telephoto lenses available on iPhones of the last few years. I tried accessing the AVCaptureDevice videoZoomFactor property, but that returns the same value for both of my iPhone's cameras.
Posted
by dsbirch.
Last updated
.
Post not yet marked as solved
0 Replies
1.2k Views
I have been able to reproduce a problem with running a SwiftUI iOS app project converted in Xcode 13 beta for use in Xcode 12. Doing so is consistently resulting in the main view's top and bottom being cut off and centered within a black background (I believe this is referred to as "letterboxing"). Here are the steps to follow: Use xcode-select to set your environment for the Xcode 13 beta and launch it. Create a new SwiftUI app In its ContentView file, add some content Run the project in the iOS Simulator Select the project in the Project navigator and in the File Inspector, change the Project Format dropdown menu to Xcode 11.4-compatible or Xcode 12-compatible. Quit the Xcode beta and the Simulator. Use xcode-select to set your environment for Xcode 12.5 and launch it. Open the project you created in Xcode 13 beta and run it in the iOS Simulator. Your simulator screen should look something like the screenshot below. I have not been able to find any way of fixing this problem once the file has been opened in Xcode 12. After relaunching Xcode 13 and rerunning it there the black borders do not appear (but there are other problems I've run into that make me want to continue development in Xcode 12 for the project where I ran into this problem.)
Posted
by dsbirch.
Last updated
.
Post marked as solved
1 Replies
932 Views
I'm trying to learn how to use Combine in an AppKit app I'm working on. I found an Apple Developer article that explains pretty much exactly what I'm trying to achieve, delaying input from an NSTextField with the .debounce operator. (https://developer.apple.com/documentation/combine/receiving-and-handling-events-with-combine) Unfortunately it doesn't seem to be working for me. I have created a function in a NSTableCellView subclass that gets called as part of the cell's configuration which looks like:     private func watchForSearchTextEntries() { print("Setting up search text observer") let sub = NotificationCenter.default .publisher(for: NSControl.textDidChangeNotification, object: searchTermText) .map( { ($0.object as! NSTextField).stringValue } ) .sink(receiveCompletion: { print ($0) }, receiveValue: { print ($0) })  } When I run the app and type in that field, nothing gets printed to the Console. As a test, I also tried adding a NotificationCenter observer that calls a method to print out the notification's object. NotificationCenter.default.addObserver(self, selector: #selector(receivedTextChangeNotification(_:)), name: NSControl.textDidChangeNotification, object: searchTermText) That works as expected. So what's going on with my attempted use of Combine?
Posted
by dsbirch.
Last updated
.
Post marked as solved
2 Replies
4.9k Views
I've experienced repeatable crashes in an iOS app using KVO, and I'm wondering if anyone else is having the same issue. This is in Xcode 11 beta 7 running in Catalina beta 7 on the iPhone XR simulator. My project targets iOS 11 as a minimum deployment, but I was able to reproduce this issue in a very simple project that targets iOS 13.Here's the pertinent code from my simple demo:Create a class to observe:class ObservableObject: NSObject { dynamic var purchaseInProgress = false dynamic var wasPurchased = false var name = "" init(name: String) { self.name = name }}In a view controller, add an iVar for a strong reference to an observers array, and an array of observable objects: var observers = [NSKeyValueObservation]() var products = [ObservableObject]()Be sure to initialized the products array with some values: override func viewDidLoad() { super.viewDidLoad() products.append(ObservableObject(name: "Hot Fudge Sundae")) products.append(ObservableObject(name: "Deluxe Cheeseburger")) }Then add an outlet to a button that can trigger the action, and a method that should be called when an object is changed: @IBAction func setupObservers() { let purchaseProgressKeyPath = \ObservableObject.purchaseInProgress let wasPurchasedKeyPath = \ObservableObject.wasPurchased for product in products { self.observers.append(product.observe(purchaseProgressKeyPath, changeHandler: { (changedProduct, change) in self.productWasChanged(changedProduct) })) self.observers.append(product.observe(wasPurchasedKeyPath, changeHandler: { (changedProduct, change) in self.productWasChanged(changedProduct) })) } } @objc func productWasChanged(_ product: ObservableObject) { }Run the project and watch it crash with:Fatal error: Could not extract a String from KeyPath Swift.ReferenceWritableKeyPath<KVOCrash.ObservableObject, Swift.Bool>: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang_overlay_Foundation_Sim/swiftlang-1100.2.259.50/swift/stdlib/public/Darwin/Foundation/NSObject.swift, line 155At least that's my result. I hope this is something Apple needs to, and will, fix. This example is borrowed from more complex code that's working just fine in Xcode 10 but crashing in the Xcode 11 beta 7.
Posted
by dsbirch.
Last updated
.