Post

Replies

Boosts

Views

Activity

Getting clicked item index in NSPathControl with pathItems instead of pathComponentCells
Since NSPathControl.setPathComponentCells(_:) and .clickedPathComponentCell() are deprecated, I'm trying to use pathItems and clickedPathItem instead. Since I'm representing a virtual path, I cannot use the NSPathControl.url setter, but instead set pathItems directly. The problem is that in the action method it doesn't seem possible to get the index of the clicked path item, nor does it seem possible to associate any kind of data with each path item, since when the action method is called, the actual object instances stored in pathItems and also the one returned by clickedPathItem change every time. Here is the sample code that reproduces the issue: class ViewController: NSViewController {     @IBOutlet weak var pathControl: NSPathControl!          override func viewDidLoad() {         super.viewDidLoad()         pathControl.pathItems = ["a", "b", "c"].map({ title in             let item = NSPathControlItem()             item.title = title             return item         })     }     @IBAction func selectPath(_ sender: NSPathControl) {         print(sender.clickedPathItem!.description, sender.clickedPathItem!.title, sender.pathItems.description)     }      } Here is a sample output (notice how the printed addresses change every time): <NSPathControlItem: 0x6000012780a0> a [<NSPathControlItem: 0x6000012780a0>, <NSPathControlItem: 0x600001278020>, <NSPathControlItem: 0x600001278090>] <NSPathControlItem: 0x600001278070> a [<NSPathControlItem: 0x600001278070>, <NSPathControlItem: 0x600001278140>, <NSPathControlItem: 0x6000012780d0>] <NSPathControlItem: 0x60000124c030> a [<NSPathControlItem: 0x60000124c030>, <NSPathControlItem: 0x60000124c080>, <NSPathControlItem: 0x60000124c070>]
7
0
705
Feb ’23
SCNNode.position is sometimes not reflected on screen
The desired outcome of the code below is that both the red and yellow spheres should be at the same position at the center of the scene, (0, 0, 0), but instead the red sphere remains at its initial position (1, 0, 0). Commenting out any of the lines marked in the code, strangely, solves the issue. The code shows a simplified version of some other code, so it would be desirable to keep the order of the lines as they currently are. Am I doing something wrong? class GameViewController: NSViewController {          override func viewDidLoad() {         super.viewDidLoad()                  let scene = SCNScene(named: "art.scnassets/ship.scn")!                  let cameraNode = SCNNode()         cameraNode.camera = SCNCamera()         scene.rootNode.addChildNode(cameraNode)         cameraNode.position = SCNVector3(x: 0, y: 0, z: 15)                  let lightNode = SCNNode()         lightNode.light = SCNLight()         lightNode.light!.type = .omni         lightNode.position = SCNVector3(x: 0, y: 10, z: 10)         scene.rootNode.addChildNode(lightNode)                  let scnView = self.view as! SCNView         scnView.scene = scene                  let parent0 = SCNNode()         scene.rootNode.addChildNode(parent0)         let parent1 = SCNNode()         scene.rootNode.addChildNode(parent1)         let sphere0 = SCNNode(geometry: SCNSphere(radius: 1))         sphere0.geometry!.firstMaterial!.diffuse.contents = NSColor.red                  let sphere1 = SCNNode(geometry: SCNSphere(radius: 1))         sphere1.geometry!.firstMaterial!.diffuse.contents = NSColor.yellow                  sphere0.position = SCNVector3(x: -1, y: 0, z: 0) // commenting out this line solves the issue         parent1.addChildNode(sphere0) // or commenting out this line solves the issue         sphere0.position = SCNVector3(x: 0, y: 0, z: 0)         parent0.addChildNode(sphere1) // or commenting out this line solves the issue                  DispatchQueue.main.asyncAfter(deadline: .now() + 1) {             print(sphere0.worldPosition, sphere1.worldPosition)         }     } }
1
0
682
Feb ’23
Cannot download Feedback Assistant data
I have been trying for several months now to download my Feedback Assistant data on privacy.apple.com. Since the very first time I tried, I keep receiving emails that "because of a technical issue it wasn't possible to download your data and you'll receive a notification as soon as the problem is solved. This procedure can last up to 60 days". And some days later I receive an email "The technical problem is now solved. To get a copy of your data, initiate a new request". I already initiated a new request at least twice, and each time I get the same outcome I just described, i.e. one email tells me the problem is solved, and the next one tells me that there is a problem that will be solved within 60 days. Am I doing something wrong?
0
0
522
Feb ’23
SCNCylinder shows mirrored texture for base and top elements
SCNBox renders the textures correctly, but SCNCylinder seems to mirror the base and top textures. The following code reproduces the issue (just set the image variable to the name of the image you're using, in this case an image with the number 2 in it): class GameViewController: NSViewController { let image = "art.scnassets/image.heic"          override func viewDidLoad() {         super.viewDidLoad()                  let scene = SCNScene(named: "art.scnassets/ship.scn")!                  let cameraNode = SCNNode()         cameraNode.camera = SCNCamera()         scene.rootNode.addChildNode(cameraNode)         cameraNode.position = SCNVector3(x: 0, y: 3, z: 3)         let scnView = self.view as! SCNView         scnView.scene = scene                  let node = SCNNode(geometry: SCNCylinder(radius: 0.5, height: 1))         node.geometry!.materials = [SCNMaterial(), SCNMaterial(), SCNMaterial()]         node.geometry!.materials[1].diffuse.contents = image         node.geometry!.materials[2].diffuse.contents = image         node.position.x = -1         node.runAction(.repeatForever(.rotate(by: 1, around: SCNVector3(x: 1, y: 0, z: 0), duration: 1)))         scene.rootNode.addChildNode(node)         let node2 = SCNNode(geometry: SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0))         node2.geometry!.materials = [SCNMaterial(), SCNMaterial(), SCNMaterial(), SCNMaterial(), SCNMaterial(), SCNMaterial()]         node2.geometry!.materials[4].diffuse.contents = image         node2.geometry!.materials[5].diffuse.contents = image         node2.position.x = 1         node2.runAction(.repeatForever(.rotate(by: 1, around: SCNVector3(x: 1, y: 0, z: 0), duration: 1)))         scene.rootNode.addChildNode(node2)         cameraNode.look(at: SCNVector3(x: 0, y: 0, z: 0))     } }
0
0
571
Feb ’23
NSOutlineView with usesAutomaticRowHeights and group row causes log "WARNING: Application performed a reentrant operation in its NSTableView delegate."
What does this warning mean? In my main app, whenever this warning is logged, the outline view begins to behave weirdly after that, overlapping rows and not responding to clicks anymore. When not using automatic row heights or group rows, the warning doesn't appear anymore. A sample project can be found here. An interesting thing is that even if there are no group rows, simply implementing the data source method func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {     return false } makes the warning appear.
0
2
946
Jan ’23
UISplitViewController.presentsWithGesture doesn't work when style != Unspecified
I tried to update the UISplitViewController in my old iOS project to use the newer column-based API, but noticed that when setting the Style to Double Column in IB from the currently selected Unspecified (Discouraged), the swipe gesture doesn't show and hide the master view controller anymore, even if the option Presents Primary With Gesture is selected. This also happens with a fresh project where I dragged the standard split view controller into the IB canvas as the initial view controller. Is this expected or am I missing something?
0
0
421
Jan ’23
Download individual iCloud file with progress callback
Is this possible and how? I've only seen examples about using NSMetadataQuery to search directories for files matching some predicate. I tried using this code let query = NSMetadataQuery() query.valueListAttributes = [NSMetadataUbiquitousItemPercentDownloadedKey] query.predicate = NSPredicate(value: true) let item = NSMetadataItem(url: url)! query.searchItems = [item] NotificationCenter.default.addObserver(forName: .NSMetadataQueryDidUpdate, object: query, queue: nil) { notification in     print(notification) } NotificationCenter.default.addObserver(forName: .NSMetadataQueryDidFinishGathering, object: query, queue: nil) { notification in     print(notification) } query.start() but this gives the following exception *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unknown kind of NSPredicate given to NSMetadataQuery (TRUEPREDICATE)' Without any predicate the query doesn't seem to start at all, like mentioned in the official documentation.
0
0
909
Jan ’23
Adding regular expression find option to UITextView
I'm trying to implement a regular expression search in a UITextView with the UITextView.findInteraction introduced in iOS 16. The documentation shows a UIFindInteraction.optionsMenuProvider property and reads You use this closure to modify, augement or omit options from the default set available in UITextSearchOptions. But it's not clear how to actually modify the UITextSearchOptions, and where these options are even stored. And how would I omit options? How can the UIActions passed as the only argument to UIFindInteraction.optionsMenuProvider be distinguished from one another?
0
0
586
Dec ’22
Attachments from App Store Review cannot be downloaded
My app update won’t be accepted because apparently it contains a bug that causes a crash that I cannot reproduce. The review team uploaded a crash report on App Store Connect on September 27th, 2022, but ever since downloading it was not possible because of an App Store Connect bug. The corresponding Feedback Assistant report is also still open. So my update has now been held in queue for almost 4 months. Can anybody please speed this up? This is unacceptable.
0
0
503
Dec ’22
How to change the modification time of a directory on FAT32
I noticed that when copying files in the Finder to a FAT32 volume, the modification dates of directories show the current date, but when copying from the same FAT32 volume to my Mac the directory modification dates are preserved. Using the Terminal command touch -mt 202110251405 path_to_file where path_to_file points to a directory doesn't seem to work: the modification time stays the same as before. When path_to_file is a regular file, it works. Is this expected, or is there some limitation with FAT32 directories?
0
0
470
Oct ’22
Hide app that was launched on login on macOS 13 Ventura
Up until macOS 12, there was a checkbox labelled "Hide" for each login item in the Users & Groups System Preferences. Now in macOS 13 the login items have been moved to the General System Preferences, but the "Hide" checkbox has disappeared. Is there a way to know from within the app that it was launched as a login item, without offering an in-app "Launch at login" option which would allow me to control the whole process, but would be quite some effort to just replace that one little option?
1
0
858
Oct ’22
How to access other users' home folder
My app allows scanning any selected directory, but I noticed that even when I enable Full Disk Access in the System Preferences, when enumerating the contents of any of the subdirectories of another user's home folder (Documents, Downloads etc.) a permission error is returned. Even when running the app from the Terminal with sudo nothing changes. Using sudo du works. Is this a limitation of macOS apps?
1
0
752
Oct ’22