以编程方式启用/禁用与macOS App的文件关联

时间:2016-11-28 14:10:13

标签: macos file-association

我已经设置了我的macOS应用程序,以便能够处理以xcasset扩展名结尾的文件夹。这并不适合所有用户,因此我想将其作为可选的首选项。有没有办法在应用程序内以编程方式打开和关闭它,还是有另一种方法来实现这种行为?

这是我目前设置的plist数据。

         <dict>
            <key>CFBundleTypeName</key>
            <string>Asset</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSTypeIsPackage</key>
            <true/>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>xcassets</string>
                <string>xcstickers</string>
            </array>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
        </dict>

0 个答案:

没有答案