Post

Replies

Boosts

Views

Activity

Reply to Why does a FileManger.DirectoryEnumerator not work on an *.photoslibrary?
In other contexts, I've run afoul of sandboxing, so I'm not totally surprised by your suggestion. Unfortunately I can't figure out what the sandbox state is for my app. When I try to access the sandboxing details for my target, my Xcode UI doesn’t resemble the help documentation that pops up. i.e. there is no “Capabilities” menu item between “General” and “Resource Tags”. I’m using Xcode 10.2 (10E125) and MacOS 10.14.4 on a MacBook Pro (Retina, 13-inch, Late 2013). If you have any suggestions, I’d greatly appreciate them.I've glanced at the documentation for programmatic use of Sandbox, but since my app iterates into ~/Pictures directory and its ordinary subdirectories, it doesn't seem likely that there is a general lockout...Is there any possibility that a Command Line Tool is lacking some setup that occurs for a Cocoa app?
May ’20
Reply to Why does a FileManger.DirectoryEnumerator not work on an *.photoslibrary?
To check whether sandboxing had any effect, I made a Cocoa app that ran this stub viewDidLoad.Whether sandboxing was on or off, the app printsdirectory existsniloverride func viewDidLoad() { super.viewDidLoad() let fileManager = FileManager.default let path = "/Users/rbnerf/Pictures/TestLibraryA.photoslibrary/" var isDirectory = ObjCBool(false) if fileManager.fileExists(atPath: path, isDirectory: &isDirectory) { if isDirectory.boolValue { print("directory exists") let contents = try? FileManager.default.contentsOfDirectory(atPath: path) print("\(contents)") } } }To show that there is content in the directory:MBP13:~ rbnerf$ ls -l /Users/rbnerf/Pictures/TestLibraryA.photoslibrarytotal 0drwxr-xr-x@ 3 rbnerf staff 96 Jul 30 2018 Attachmentsdrwxr-xr-x@ 5 rbnerf staff 160 Jan 1 09:24 Mastersdrwxr-xr-x@ 10 rbnerf staff 320 May 25 12:33 databasedrwxr-xr-x@ 7 rbnerf staff 224 May 27 10:31 privatedrwxr-xr-x@ 9 rbnerf staff 288 May 27 10:31 resources
May ’20
Reply to Why does a FileManger.DirectoryEnumerator not work on an *.photoslibrary?
The Apple Thought Police ate my previous detailed post, so I'll redo in brief...The suggestions about Sandboxing and Hardening were somewhat useful, but I still can't getFileManager.default.contentsOfDirectory(atPath: path) to return contents for a photos library in ~/Pictures.It will only return contents for a photos library in other directories, e.g. my home directory, or on an external disk.The Sandboxing and Hardening options have different focus:Sandboxing is concerned with access to ~/PicturesHardening is concerned with photos librariesNeither seem essential, because I could access the libraries not in ~/Pictures without either Sandboxing or Hardening being used.As an undocumented "feature", I regard this as a bug.
May ’20
Reply to Why does a FileManger.DirectoryEnumerator not work on an *.photoslibrary?
The "app" that I used for testing is the same as before, except that I use different photo libraries:override func viewDidLoad() { super.viewDidLoad() let fileManager = FileManager.default //let path = "/Volumes/Little4a/PhotosByTopic/EagleHarbor.photoslibrary" //E let path = "/Users/rbnerf/Pictures/TestLibraryA.photoslibrary" //A //let path = "/Users/rbnerf/TestLibraryB.photoslibrary" //B //let path = "/Users/rbnerf/Pictures/" //P print ("\(path)") var isDirectory = ObjCBool(false) if fileManager.fileExists(atPath: path, isDirectory: &isDirectory) { if isDirectory.boolValue { print("directory exists") let contents = try? FileManager.default.contentsOfDirectory(atPath: path) print("\(contents)") } } }I have run the app with the 4 combinations of Sandboxing (with ~/Pictures readonly )and Hardened Runtime (with Photos), using each of the three libraries, (E,A & B) [B is a duplicate of A]The contents are non-nil for E & B whenever Sandboxing is off, Hardening has no effect. No combo produced non-nil content for AMy intent is to make several apps for my own use, and see whether there is sufficient utility to offer them to others.I want to browse the file system tree to analyze various topics in 20 years worth of files. For example:Which images have been used in documents, and where? How many duplicate copies?What were the dates when I was working on particular Xcode projects? How do I distinguish projects abandoned as dead ends from those that are still the "best" version?What topics was I using the Mac for over the 20 years?
May ’20
Reply to Use Xcode to see files written by iOS app?
I'm answering my own question: With the device plugged in, open the Devices and Simulators Window Select the device You will see a table view of Installed Apps Select the app of interest At the bottom of the table view is the "gear" icon -- select it Download Container will work, despite Show Container being empty Using control-click in the Finder to Show Contents allows drilling down to the *.sqlite files.
Sep ’21