关于iOS 模拟器(Simulator)

作者: singlestep | 来源:发表于2017-02-22 19:55 被阅读1203次

背景:
因为前段时间模拟器的一个小问题排查了很久,所以系统的查阅官方文档,有了此篇文章.文章为iPhone模拟器的介绍.
查阅过程中最大的收获就是在xcode 8.2 版本之后,可以使用xcurn工具对屏幕进行录制.

模拟器访问方式

两种类型访问:
1.启动模拟器并运行项目.编译项目时,直接选择任一模拟器运行
2.启动模拟器但不运行项目. xcode ~> open developer tool ~> simulator 或者 右键xcode快捷菜单 ~> open developer tool ~> simlulator

home 功能

command + shift + h

地图模拟位置

debug -> location -> custom location

下载/删除

下载 : xcode ~> command + , ~> components
删除 : xcode ~> windows ~> devices

键盘输入

simulator ~> hardware ~> keyboard ~> uses the same ...

appstore 下载

模拟器是无法从 App Store 下载程序,这可能是基于刷app一些考虑

截图/屏幕录制

截图:
1 . xcrun simctl io booted screenshot (xcode 8.2)
2 . command + s
屏幕录制:
开始: xcrun simctl io booted recordVideo <filename>.<extension>
结束: command + c

差异性

模拟器在硬件和API方面都和真机存在差异性.
API方面 : 通知,拍照,日历,提醒事件...
硬件: 摄像头, 麦克风 , 陀螺仪 ,光传感器...

对于有些API的不支持,可以使用如下语句避免不必要的麻烦

#if TARGET_IPHONE_SIMULATOR

#elif TARGET_OS_IPHONE

#endif

相关文章

网友评论

    本文标题:关于iOS 模拟器(Simulator)

    本文链接:https://www.haomeiwen.com/subject/mfwmwttx.html