inket / MacSymbolicator

Symbolicating macOS/iOS crash reports, easily.
GNU General Public License v2.0
1.29k stars 91 forks source link

SpotlightSearch isn't returning results that are on desktop and are found with terminal mdfind command #41

Closed edorphy closed 1 month ago

edorphy commented 8 months ago

For some reason the spotlight search (NSMetadataQuery) isn't finding a .DSYM that is in my desktop directory automatically. I know the UUID is correct because running the mdfind command in terminal has no problem.

I was looking through historical issues related to "com_apple_xcode_dsym_uuids" and I'm wondering if this isn't working as expected again. https://github.com/inket/MacSymbolicator/issues/16

My machine is running macOS Sonoma 14.2.1 (23C71)

user@directory % mdfind "com_apple_xcode_dsym_uuids == E3D58A29-035A-37E5-A5FD-01C818692997"
/Users/user/Desktop/DSYMS/AppName.app.dSYM

Trying to force the app to search for it in the symbolicate button yields no results. From Xcode Version 15.2 (15C500b)

    @objc func symbolicate() {
        spotlight.search(forUUIDs: ["E3D58A29-035A-37E5-A5FD-01C818692997"]) { result in
            print(result)
        }

--> Optional([])

Thoughts on having a settings option the user can turn on to run the mdfind command in a Process if the spotlight search came up empty?

From the same project, this works:

    @objc func symbolicate() {
        let command = "mdfind \"com_apple_xcode_dsym_uuids == E3D58A29-035A-37E5-A5FD-01C818692997\""
        let result = command.run()
        print(result.output ?? "no results")

--> /Users/user/Desktop/DSYMS/AppName.app.dSYM

inket commented 7 months ago

Hi @edorphy! Thanks for reporting this.

I looked deeply into this and I was able to reproduce it (but had to put the DSYM in Desktop as well). I believe NSMetadataSearchQuery will only find DSYMs in directories that the user has allowed MacSymbolicator to access. This is part of macOS sandboxing.

I think the solution might be to make MacSymbolicator ask for Full Disk Access permission so that it's able to find all DSYMs on disk.