Date
Dec. 22nd, 2024
 
2024年 11月 22日

Post: Determining UTIs defined by App bundles

Determining UTIs defined by App bundles

Published 12:04 Apr 13, 2017.

Created by @ezra. Categorized in #Programming, and tagged as #macOS.

Source format: Markdown

Table of Content

We know that lsregister -dump is an option; however, I'm left to wonder if there isn't a better solution.

In my searching I've come across a private API that could be of use:

__UTCopyDeclaredTypeIdentifiers

Since there's absolutely no documentation for it, I give you this:

import Foundation
@_silgen_name("_UTCopyDeclaredTypeIdentifiers") func UTCopyDeclaredTypeIdentifiers() -> CFArray

let UTIs = UTCopyDeclaredTypeIdentifiers()
print(UTIs)

Should print all the UTIs that the function knows about. Pretty simple.

Pinned Message
HOTODOGO
The Founder and CEO of Infeca Technology.
Developer, Designer, Blogger.
Big fan of Apple, Love of colour.
Feel free to contact me.
反曲点科技创始人和首席执行官。
开发、设计与写作皆为所长。
热爱苹果、钟情色彩。
随时恭候 垂询