简体   繁体   English

有没有办法将我的iOS模拟器应用程序数据从一个模拟器(iPhone 7)移动到另一个模拟器(iPad Pro 12.9)?

[英]Is there a way to move my iOS Simulator app data from one simulator (iPhone 7) to another (iPad Pro 12.9)?

I have an app built and running in my iPhone 7 simulator using Xcode 8. It's loaded up in the simulator and I've loaded the app with stored data now stored locally. 我有一个使用Xcode 8在iPhone 7模拟器中构建并运行的应用程序。它已加载到模拟器中,我已经加载了应用程序,其中存储的数据现在存储在本地。

When I run that same app on my iPad Pro 12.9 simulator, it acts like a fresh device and has none of the stored data in it for my app. 当我在iPad Pro 12.9模拟器上运行相同的应用程序时,它就像一个新设备,并没有为我的应用程序存储的数据。

Is there a way to have all of the simulators use the same app storage? 有没有办法让所有模拟器使用相同的应用程序存储? Or at least any easy way to move apps between them? 或者至少在他们之间移动应用程序的任何简单方法?

  • Go to ~/Library/Developer/CoreSimulator/Devices . 转到〜/ Library / Developer / CoreSimulator / Devices (Library folder is hidden generally. Unhide the folder with this command in terminal - defaults write com.apple.finder AppleShowAllFiles YES and restart the Finder). (库文件夹通常是隐藏的。在终端中使用此命令取消隐藏文件夹 - 默认情况下写入com.apple.finder AppleShowAllFiles YES并重新启动Finder)。
  • You will find the bunch of folders specific to the simulator at the mentioned path. 您将在上述路径中找到特定于模拟器的一堆文件夹。 Also find plist, named device_set.plist , which has the entry of all the available simulators. 还可以找到名为device_set.plist的 plist,它包含所有可用模拟器的条目。

在此输入图像描述

  • Find the ids of the source and destination simulators you are interested in under Root->DefaultDevices->com.apple.CoreSimulator.SimRuntime.iOS-XX-X (XX-X - OS version that you run your simulator on.) Root-> DefaultDevices-> com.apple.CoreSimulator.SimRuntime.iOS-XX-X (XX-X - 运行模拟器的操作系统版本)下找到您感兴趣的源和目标模拟器的ID。
  • Once you find the ids, search the folder with that name in the above-mentioned path. 找到ID后,在上述路径中搜索具有该名称的文件夹。
  • The simulator folder will contain data and device.plist . 模拟器文件夹将包含datadevice.plist
  • Copy the data folder from source simulator and replace it in the destination simulator. 从源模拟器复制数据文件夹并将其替换为目标模拟器。
  • That's it! 而已! If your destination simulator is open, just restart it and it should reflect the data of source simulator. 如果您的目标模拟器已打开,只需重新启动它,它应该反映源模拟器的数据。

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

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