Xcode6的iPhone模拟器文件夹

在 Xcode6中,iPhone 模拟器里应用数据的存储位置发生了变化。iOS 8之前,应用的文档存储位置可以在这里找到:

~/Library/Application\ Support/iPhone\ Simulator/<iOS_Version>/Applications/<application_id>/Documents

在 Xcode6中,这个地址变成了:

~/Library/Developer/CoreSimulator/

但是这个地址只包含了不同类型模拟器的一个文件夹列表。进入到这个文件夹,你可以看到类似于这样的东西: 每个文件夹都和某种模拟器相对应。为了知道哪个文件夹对应哪个模拟器,在终端中使用下面这个命令

xcrun simctl list  

可以得到类似下面的输出

== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)  
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)  
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)  
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)  
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)  
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)  
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)  
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)  
Resizable iPhone (com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone)  
Resizable iPad (com.apple.CoreSimulator.SimDeviceType.Resizable-iPad)  
== Runtimes ==
iOS 7.0 (7.0 - Unknown) (com.apple.CoreSimulator.SimRuntime.iOS-7-0) (unavailable, runtime path not found)  
iOS 7.1 (7.1 - Unknown) (com.apple.CoreSimulator.SimRuntime.iOS-7-1) (unavailable, runtime path not found)  
iOS 8.0 (8.0 - 12A365) (com.apple.CoreSimulator.SimRuntime.iOS-8-0)  
== Devices ==
-- iOS 7.0 --
-- iOS 7.1 --
-- iOS 8.0 --
    iPhone 4s (8C1303A2-C590-4822-BB9B-12EC32035C8C) (Shutdown)
    iPhone 5 (402C822D-567F-4F3A-B113-1499C5A7949C) (Shutdown)
    iPhone 5s (B6D71F6A-E94B-47ED-AF25-882FDEF8E6F5) (Shutdown)
    iPhone 6 Plus (5BCD1507-6F06-4D66-B71D-47670EB703B2) (Shutdown)
    iPhone 6 (00100565-4E4D-4D9A-A875-544E0A6E4F4F) (Booted)
    iPad 2 (187D75DD-824D-4381-AE2F-BDF57FEB87E0) (Shutdown)
    iPad Retina (604667D3-8366-4147-B0AD-F7840198713C) (Shutdown)
    iPad Air (01D6AEBC-F12A-47EE-82CB-0140AF117AE0) (Shutdown)
    Resizable iPhone (9C138BCD-BFB9-4AEB-A218-F0F99F678220) (Shutdown)
    Resizable iPad (4966C908-AAA7-43EC-8E3A-EADF8BFA3C05) (Shutdown)

现在我要找到iPhone 6的模拟器,它的设备 ID 是00100565-4E4D-4D9A-A875-544E0A6E4F4F。然后你就可以进入这个文件夹,下面这个路径列出了所有安装在这个模拟器中的应用:

~/Library/Developer/CoreSimulator/Devices/00100565-4E4D-4D9A-A875-544E0A6E4F4F/data/Containers/Data/Application/

现在就可以定位到某个应用的Documents文件夹了

/Users/weimenglee/Library/Developer/CoreSimulator/Devices/00100565-4E4D-4D9A-A875-544E0A6E4F4F/data/Containers/Data/Application/FD7949EA-7D39-4BC6-95F4-77F320592651/Documents/
comments powered by Disqus