gpt4 book ai didi

swift - 系统默认值?

转载 作者:行者123 更新时间:2023-11-28 07:26:03 26 4
gpt4 key购买 nike

我正在用 Swift 为 macOS 编写一个应用程序。我将使用 UserDefaults API 逐个用户地保存一组参数。我正在寻找一个类似的地方来保存许可数据,以便在授予许可后,设备上的所有用户都可以共享该许可。

(这个应用程序最初是用 Java 编写的,我正在用 Swift 重新实现它。旧应用程序使用 Preferences.userRoot() 来存储用户数据,使用 Preferences.systemRoot() 用于许可证数据。macOS 中的类似结构是什么?)

最佳答案

按照惯例,许可证数据应保存在 ~/Library/Application Support 中,它通常包含所有特定于应用程序的数据。

来自Library Directory Details document :

Contains all app-specific data and support files. These are the files that your app creates and manages on behalf of the user and can include files that contain user data.

By convention, all of these items should be put in a subdirectory whose name matches the bundle identifier of the app. For example, if your app is named MyApp and has the bundle identifier com.example.MyApp, you would put your app’s user-specific data files and resources in the ~/Library/Application Support/com.example.MyApp/ directory. Your app is responsible for creating this directory as needed.

Resources required by the app to run must be placed inside the app bundle itself.

关于swift - 系统默认值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56585291/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com