mac中ios模拟器的常用操作

下面主要列出了以下几个常用的命令,包括:查找ios模拟器中包含哪些机型、启动ios模拟器中的指定机型。

1、查找ios模拟器中包含哪些机型

1
instruments -s

会输出以下模拟机型,也就是说可以启动以下这些机型进行模拟

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Known Devices:
lsqy的MacBook Pro
Apple TV (12.2) [CD901014-4F0C-46C3-AE9A-A22AC37493FB] (Simulator)
Apple TV 4K (12.2) [31425E49-958D-40E3-8393-93EA246943F0] (Simulator)
Apple TV 4K (at 1080p) (12.2) [6E1C2AFC-32DD-4CC5-A280-8049BD3B8A1A] (Simulator)
Apple Watch Series 2 - 38mm (5.2) [26759A5E-00B9-4BD4-A5D2-5AE544DA841B] (Simulator)
Apple Watch Series 2 - 42mm (5.2) [33BA7025-31F7-42A7-817B-A4A70CFC60A8] (Simulator)
Apple Watch Series 3 - 38mm (5.2) [03739305-4300-452F-BB8B-8671854BD210] (Simulator)
Apple Watch Series 3 - 42mm (5.2) [CE4486B9-E587-4AC8-9821-9E50D7FF8BFB] (Simulator)
iPad (5th generation) (12.2) [D46751EA-EDD9-4C92-8652-14F339A8372C] (Simulator)
iPad (6th generation) (12.2) [20A0FEF8-C34F-4960-B7DF-AA2A7A9EEEF6] (Simulator)
iPad Air (12.2) [ED0958FA-0C6B-4E2E-B87D-9B272F49C9AD] (Simulator)
iPad Air (3rd generation) (12.2) [E981EDDA-587C-4194-84A8-B018E909046B] (Simulator)
iPad Air 2 (12.2) [F1000542-2E19-415D-A6A6-C791D07BC504] (Simulator)
iPad Pro (10.5-inch) (12.2) [F950D852-A65E-4797-9B23-53C0A2510815] (Simulator)
iPad Pro (11-inch) (12.2) [B34F8807-15F1-45F2-966D-65BBB45A2FEB] (Simulator)
iPad Pro (12.9-inch) (12.2) [5BFA185B-E0FB-43ED-8991-B79982ECE0F8] (Simulator)
iPad Pro (12.9-inch) (2nd generation) (12.2) [DCE2842B-AF9A-40CC-AAC6-D6F12828C937] (Simulator)
iPad Pro (12.9-inch) (3rd generation) (12.2) [8EBD2F29-9C1E-42C6-B95D-2F3273CEB56E] (Simulator)
iPad Pro (9.7-inch) (12.2) [79CEBBA2-5665-44D2-BC2D-EF01E971672B] (Simulator)
iPhone 5s (12.2) [0A515BFC-2C47-4093-B80E-85BE96712436] (Simulator)
iPhone 6 (12.2) [5D695AAE-8D35-4F30-8885-740A85F22AB6] (Simulator)
iPhone 6 Plus (12.2) [8A39537F-0EED-4244-A114-223AF0126B0C] (Simulator)
iPhone 6s (12.2) [1913C53F-394E-446E-A3A7-4DAA87F9D578] (Simulator)
iPhone 6s Plus (12.2) [B2937386-20A9-4ACC-A63E-982BC10F661C] (Simulator)
iPhone 7 (12.2) [A3D3511E-AB79-4849-B104-3D9803198203] (Simulator)
iPhone 7 Plus (12.2) [7A47C656-0C7A-4002-98D0-CB0F6167C138] (Simulator)
iPhone 8 (12.2) [D6083F0A-967F-40D8-88C2-684BDB927B99] (Simulator)
iPhone 8 Plus (12.2) [980B8AED-7F44-4D95-A6F7-AAF561F88883] (Simulator)
iPhone SE (12.2) [09A3F89A-4BFE-4B4D-8793-8D5C1B4B1E36] (Simulator)
iPhone X (12.2) [E374247E-832D-4B61-804D-1C085CA897BD] (Simulator)
iPhone Xs (12.2) [DDDF0B87-7295-417B-9A85-27441B4282AD] (Simulator)
iPhone Xs (12.2) + Apple Watch Series 4 - 40mm (5.2) [6E29B703-74F6-40C7-99A8-0D9CEB5A9777] (Simulator)
iPhone Xs Max (12.2) [F74F45D2-29EA-4490-8490-933FC4084BEA] (Simulator)
iPhone Xs Max (12.2) + Apple Watch Series 4 - 44mm (5.2) [B710C546-C80C-400C-829B-8487D411BF6E] (Simulator)
iPhone Xʀ (12.2) [7E8332CC-2279-40CE-B86B-AD7D21227D0A] (Simulator)
Known Templates:
"Activity Monitor"
"Allocations"
"Blank"
"Core Animation"
"Core Data"
"Counters"
"Energy Log"
"File Activity"
"Game Performance"
"Leaks"
"Metal System Trace"
"Network"
"SceneKit"
"System Trace"
"System Usage"
"Time Profiler"
"Zombies"

2、启动ios模拟器中的指定机型

注意启动的时候要将名称输入完全,比如如果要启动iPhone X,则需要将后面括号里的内容也带上iPhone X (12.2),要不然模拟器会不知道要具体启动哪个机型

1
xcrun instruments -w 'iPhone X (12.2)'