unity 各平台下文件读写沙箱目录及ios审核(原)
2014-10-20 10:20
836 查看
各平台目录
IOS:
Application.dataPath : private/var/Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data
Application.streamingAssetsPath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data/Raw
Application.persistentDataPath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Documents
Application.temporaryCachePath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Library/Caches
Android:
Application.dataPath : /data/app/xxx.xxx.xxx.apk
Application.streamingAssetsPath : jar:file:///data/app/xxx.xxx.xxx.apk/!/assets
Application.persistentDataPath : /data/data/xxx.xxx.xxx/files
Application.temporaryCachePath : /data/data/xxx.xxx.xxx/cache
Windows:
Application.dataPath : /Assets
Application.streamingAssetsPath : /Assets/StreamingAssets
Application.persistentDataPath : C:/Users/xxxx/AppData/LocalLow/CompanyName/ProductName
Application.temporaryCachePath : C:/Users/xxxx/AppData/Local/Temp/CompanyName/ProductName
Mac:
Application.dataPath : /Assets
Application.streamingAssetsPath : /Assets/StreamingAssets
Application.persistentDataPath : /Users/xxxx/Library/Caches/CompanyName/Product Name
Application.temporaryCachePath : /var/folders/57/6b4_9w8113x2fsmzx_yhrhvh0000gn/T/CompanyName/Product Name
无论 android或ios我们都可以用Application.persistentDataPath来获取沙箱路径
注意,不要使用Application.dataPath 这个在ios8以前是可读写,但ios8后,只可读不可写
沙箱内目录结构
1 android打包后的apk实际上是jar压缩包,可以用解压缩打开查看
2 ios安装后的沙箱目录
Documents 目录:这个目录用于存储用户数据,iTunes备份和恢复的时候会包括此目录
AppName.app 目录:这是应用程序的程序包目录,包含应用程序的本身。由于应用程序必须经过签名,所以您在运行时不能对这个目录中的内容进行修改,否则可能会使应用程序无法启动。
Library 目录:这个目录下有两个子目录:Caches 和 Preferences
Preferences 目录:包含应用程序的偏好设置文件。您不应该直接创建偏好设置文件,而是应该使用NSUserDefaults类来取得和设置应用程序的偏好.
Caches 目录:存放缓存文件,iTunes不会备份此目录,此目录下文件不会在应用退出删除,保存应用程序再次启动过程中需要的信息。
tmp 目录:这个目录用于存放临时文件,保存应用程序再次启动过程中不需要的信息。有可能在程序退出或设备重启后清空目录,但实测ipad下重启应用或重启设备后并没有清空
iTunes在与iPhone同步时,备份所有的Documents和Library文件。
关于审核
1 android下审核标准较低,所以不做讨论
2 ios审核时会要求Documents 下文件不可以太多,太大所。以我们要通过审核,这里只保存简单的用户信息,其它游戏信息可以保存在Library /Caches 下,我们可以在Library /Caches 下新建一个userdata目录来保存需要的信息
IOS:
Application.dataPath : private/var/Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data
Application.streamingAssetsPath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data/Raw
Application.persistentDataPath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Documents
Application.temporaryCachePath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Library/Caches
Android:
Application.dataPath : /data/app/xxx.xxx.xxx.apk
Application.streamingAssetsPath : jar:file:///data/app/xxx.xxx.xxx.apk/!/assets
Application.persistentDataPath : /data/data/xxx.xxx.xxx/files
Application.temporaryCachePath : /data/data/xxx.xxx.xxx/cache
Windows:
Application.dataPath : /Assets
Application.streamingAssetsPath : /Assets/StreamingAssets
Application.persistentDataPath : C:/Users/xxxx/AppData/LocalLow/CompanyName/ProductName
Application.temporaryCachePath : C:/Users/xxxx/AppData/Local/Temp/CompanyName/ProductName
Mac:
Application.dataPath : /Assets
Application.streamingAssetsPath : /Assets/StreamingAssets
Application.persistentDataPath : /Users/xxxx/Library/Caches/CompanyName/Product Name
Application.temporaryCachePath : /var/folders/57/6b4_9w8113x2fsmzx_yhrhvh0000gn/T/CompanyName/Product Name
无论 android或ios我们都可以用Application.persistentDataPath来获取沙箱路径
注意,不要使用Application.dataPath 这个在ios8以前是可读写,但ios8后,只可读不可写
沙箱内目录结构
1 android打包后的apk实际上是jar压缩包,可以用解压缩打开查看
2 ios安装后的沙箱目录
Documents 目录:这个目录用于存储用户数据,iTunes备份和恢复的时候会包括此目录
AppName.app 目录:这是应用程序的程序包目录,包含应用程序的本身。由于应用程序必须经过签名,所以您在运行时不能对这个目录中的内容进行修改,否则可能会使应用程序无法启动。
Library 目录:这个目录下有两个子目录:Caches 和 Preferences
Preferences 目录:包含应用程序的偏好设置文件。您不应该直接创建偏好设置文件,而是应该使用NSUserDefaults类来取得和设置应用程序的偏好.
Caches 目录:存放缓存文件,iTunes不会备份此目录,此目录下文件不会在应用退出删除,保存应用程序再次启动过程中需要的信息。
tmp 目录:这个目录用于存放临时文件,保存应用程序再次启动过程中不需要的信息。有可能在程序退出或设备重启后清空目录,但实测ipad下重启应用或重启设备后并没有清空
iTunes在与iPhone同步时,备份所有的Documents和Library文件。
关于审核
1 android下审核标准较低,所以不做讨论
2 ios审核时会要求Documents 下文件不可以太多,太大所。以我们要通过审核,这里只保存简单的用户信息,其它游戏信息可以保存在Library /Caches 下,我们可以在Library /Caches 下新建一个userdata目录来保存需要的信息
相关文章推荐
- Unity常用目录对应的Android && iOS平台地址
- IOS的一些文件操作。(沙箱) 在Documents目录下创建文件
- unity中的文件存储路径与各平台(Android,iOS)的关系
- iOS的沙箱目录和文件操作
- 详解ios文件系统文件目录读写操作
- Unity文件目录的读写
- 【Unity】ios平台IAP内购和沙箱测试流程详解(开发中遇到的坑)
- [绍棠] iOS文件目录和文件操作 及NSFileManager的读写操作
- IOS的一些文件操作。(沙箱) 在Documents目录下创建文件
- [IOS]关于文件(文件目录)的读写操作
- IOS的一些文件操作。(沙箱) 在Documents目录下创建文件
- unity 各平台本地文件的读取目录
- Unity读取IOS平台文件
- Unity(六) 使用XML/JSON/Binary数据文件封装场景以及StreamingAssets目录的安卓平台同步
- unity IOs读写txt文件
- 详解ios文件系统文件目录读写操作-备用
- unity关于各个平台文件读写问题
- Unity 关于安卓和各平台读写本地json文件,WWW读取本地文件,Unity各路径API(persistentDataPath,StreamingAssets文件夹),目前较完整的详解
- [Unity基础]移动平台下的文件读写
- [Unity基础]移动平台下的文件读写