简体   繁体   English

如何从Xcode查看iOS应用程序中的数据?

[英]How can I see data inside an iOS app from Xcode?

An iOS app is supposed to remove all data when a user logs out of the app. 用户注销后,iOS应用程序应删除所有数据。 This has been completed, but I am looking for a way to verify that there is no data left over in the app (SQLite, user preferences, etc.) 这已经完成,但是我正在寻找一种方法来验证应用程序中是否没有剩余数据(SQLite,用户首选项等)。

I cannot figure out how IO can link to the app from Xcode (or from somewhere else and "look" into the app after a user logs out and confirm that all data is gone. 我无法弄清楚IO如何从Xcode链接到应用程序(或从其他地方链接到应用程序,并在用户注销并确认所有数据都消失之后“查看”应用程序)。

Bryan 布赖恩

I cannot figure out how IO can link to the app from Xcode (or from somewhere else and "look" into the app after a user logs out and confirm that all data is gone. 我无法弄清楚IO如何从Xcode链接到应用程序(或从其他地方链接到应用程序,并在用户注销并确认所有数据都消失之后“查看”应用程序)。

You can download the directory that contains all the app's data: 您可以下载包含所有应用程序数据的目录:

  1. Open the Devices and Simulators window in Xcode and connect to the device you want to examine. 在Xcode中打开“ 设备和模拟器”窗口,然后连接到要检查的设备。

  2. You'll see a list of the apps that you've installed on the device. 您会看到设备上已安装的应用程序的列表。 Find the one you're testing in the list and click on it. 在列表中找到要测试的模块,然后单击它。

  3. Click the gear icon at the bottom of the list and choose Download Container... . 点击列表底部的齿轮图标,然后选择下载容器...。

  4. Xcode will download a bundle named something like com.your.identifier 2018-12-17 14/18.28.448.xcappdata . Xcode将下载名为com.your.identifier 2018-12-17 14/18.28.448.xcappdata类的捆绑com.your.identifier 2018-12-17 14/18.28.448.xcappdata

  5. Find the downloaded bundle (you can choose where Xcode puts it) and control-click on it. 找到下载的捆绑包(您可以选择Xcode放在哪里)并按住Control键单击它。 Choose Show Package Contents . 选择显示包装内容 Finder will open a window showing you everything in the app's container. Finder将打开一个窗口,向您显示应用程序容器中的所有内容。

In addition to just looking at the app container, you can also modify the container and install it on a device. 除了查看应用程序容器外,您还可以修改容器并将其安装在设备上。 This can be useful for testing. 这对于测试很有用。 For example, you could modify or delete an important data file from the container and install it on a test device to test that your app gracefully handles an error situation. 例如,您可以修改或删除容器中的重要数据文件,然后将其安装在测试设备上,以测试您的应用是否能够正确处理错误情况。 Or, if someone testing your app runs into a problem you can't reproduce, you can get a copy of the app container from them and install it on your own device. 或者,如果测试您的应用程序的人遇到问题而您无法重现,则可以从他们那里获取应用程序容器的副本并将其安装在您自己的设备上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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