Date
Sep. 8th, 2024
 
2024年 8月 6日

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.
反曲点科技创始人和首席执行官。
程序猿、设计师、奇怪的博主。
苹果死忠、热爱色彩斑斓的世界。
如有意向请随时 与我联系