<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ios-sim on prometheus</title><link>https://new.halfrost.com/zh/categories/ios-sim/</link><description>Recent content in ios-sim on prometheus</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><copyright>halfrost</copyright><lastBuildDate>Thu, 18 Aug 2016 02:07:45 +0000</lastBuildDate><atom:link href="https://new.halfrost.com/zh/categories/ios-sim/index.xml" rel="self" type="application/rss+xml"/><item><title>给 iOS 模拟器“安装” app 文件</title><link>https://new.halfrost.com/zh/ios_simulator_ios_sim/</link><pubDate>Thu, 18 Aug 2016 02:07:45 +0000</pubDate><guid>https://new.halfrost.com/zh/ios_simulator_ios_sim/</guid><description>前言 刚刚接触iOS的时候，我就一直很好奇，模拟器上面能不能直接安装app呢？如果可以，我们就直接在模拟器上面聊QQ和微信了。直到昨天和朋友们聊到了这个话题，没有想到还真的可以给模拟器“安装”app！
一.应用场景 先来谈谈是什么情况下，会有在模拟器上安装app的需求。
在一个大公司里，对源码的管理有严格的制度，非开发人员是没有权限接触到源码的。对苹果的开发证书管理也非常严格，甚至连开发人员也没有发布证书，证书只在持续集成环境或者Appstore产线里面，或者只在最后打包上架的人手上。
那么现在就有这样的需求，开发人员搭建好UI以后，要把开发完成的Alapha版给到UI设计师那边去评审，看看是否完全达到要求，达不到要求就需要打回来重做。
一般做法就是直接拿手机去安装一遍了。直接真机看效果。不过要是设计师和开发不在同一个地方的公司，一个在北京一个在上海，这种就没法安装了。源码又无法导出给设计师，让他运行一下Xcode跑一下模拟器。这个时候就比较麻烦了。(一般也没人遇到这么蛋疼的事情吧)
那么现在就有给模拟器安装app的需求了，那开发人员如何能把开发版的app给打包出来给其他模拟器安装呢？
二.解决办法 解决思路，想要别人的模拟器运行起我们开发的app，最简单的办法就是把我们DerivedData的数据直接拷贝到别人模拟器上面，就可以了。当然还要考虑到设计师也许并不会一些命令行命令，我们的操作越傻瓜越好。
1.拷贝本地的DerivedData里面的debug包 Mac的拷贝命令有cp和ditto，建议用ditto进行拷贝工作。
Usage: ditto [ &amp;lt;options&amp;gt; ] src [ ... src ] dst &amp;lt;options&amp;gt; are any of: -h print full usage -v print a line of status for each source copied -V print a line of status for every file copied -X do not descend into directories with a different device ID -c create an archive at dst (by default CPIO format) -x src(s) are archives -z gzip compress CPIO archive -j bzip2 compress CPIO archive -k archives are PKZip --keepParent parent directory name src is embedded in dst_archive --arch archVal fat files will be thinned to archVal multiple -arch options can be specified archVal should be one of &amp;#34;ppc&amp;#34;, &amp;#34;i386&amp;#34;, etc --bom bomFile only objects present in bomFile are copied --norsrc don&amp;#39;t preserve resource data --noextattr don&amp;#39;t preserve extended attributes --noqtn don&amp;#39;t preserve quarantine information --noacl don&amp;#39;t preserve ACLs --sequesterRsrc copy resources via polite directory (PKZip only) --nocache don&amp;#39;t use filesystem cache for reads/writes --hfsCompression compress files at destination if appropriate --nopreserveHFSCompression don&amp;#39;t preserve HFS+ compression when copying files --zlibCompressionLevel num use compression level &amp;#39;num&amp;#39; when creating a PKZip archive --password request password for reading from encrypted PKZip archiveDitto比cp命令更好的地方在于：</description></item></channel></rss>