简体   繁体   中英

Cannot access application file in container bundle

I want to access an sqlite database file which I have bundled to my iOS application. This works fine, because I can see I can read/write from/to the database by the application logic. If I run the application by the simulator I can find the database here:

file:///Users/<Username>/Library/Developer/CoreSimulator/Devices/<DeviceID>/data/Containers/Bundle/Application/<ApplicationID>/<AppName>/test.db

But if I run the application on a real device it seems difficult to access the data, In Xcode I've tried to export the container in "Devices and simulators", download it, open the package content of the.xcappdata file but I can't find the file "test.db":

Where and How can I access the file?

在此处输入图像描述

Xcode will not import the Application part which contains the binary and all the files you bundle with it. When working with an file which is bundled in your app it is better to copy it into Library or Document directory the first time the application is run. So you never modify the bundle one which should only be a init file and not a working file. When it is in Document or Library, you can then get it via xCode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM