ionic应用在mac上使用Xcode7.2(7C68)进行iphone真机测试

来源:互联网 发布:如何看待马蓉 知乎 编辑:程序博客网 时间:2024/05/02 01:47
1.前提环境 : 假设已经在mac(OS X El Capitan 版本 10.11.2)上装好了Xcode7.2(7C68)和ionic环境
2.运行添加ios平台命令 ionic platform add ios
3.打开Xcode,导入项目
4.添加Apple ID : Xcode - Preferences - Accounts - +
5.添加成功后,在Apple IDs下单击选择刚才添加的Apple ID,可以看到右侧的Team Name后边的iOS和Mac都是free,
然后双击(或点击右下角的View Details...按钮)打开Team Name下的那条记录,在Signing Identities下点击iOS Development后边的create按钮,Xcode会自动在后台帮你生成Dev模式需要的certificate(Xcode7以前是没有这个自动生成的,需要手动工作),稍等片刻,完了之后点done
6.在项目target的General页的Identity->Team中选中刚才Apple ID对应的项,然后我选择了Deployment->Main Interface选项

7.运行,报异常

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x14e7b130> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'

搜索Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x14e7b130> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
找到这个文章,看到了这句话Error if Main Interface .xib is selected,于是我就把Main Interface的选项清空,然后再运行,异常依旧,我再仔细看了这段内容,发现是这么说的: Do not select a Main Interface - this should be left blank. Make sure you have selected all desired orientations and 'Requires full screen',然后我就找Requires full screen确保选中,再把Main Interface的下面一个项Device Orientation全部选上,然后再运行,成功了,app项目正常安装到iphone上运行了,Xcode后台是这样显示的

我琢磨着上面那段话的意思,应该是只用选LandscapeLeft和LandscapeRight两项就可以了,改了一下,运行看看,
发现在iphone5上是直接横屏的,选上Upside Down也是横屏,选上Portrait后就竖屏了.

PS1:刚开始的时候,是运行后,报这个异常: could not find developer disk image 错误然后我就把Xcode 9.3配置包放到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport路径下
PS2:我开始的时候登录了开发者账号,理论上Xcode7是不需要开发者账号就可以真机测试的

参考资料:
Publishing and Ionic Angular App for IOS - The Hidden Steps & Pitfalls
http://www.righthandedmonkey.com/2016/01/publishing-ionic-angular-app-for-ios.html

Xcode 9.3配置包
http://my.oschina.net/Nealyang/blog/650347

XCODE真机测试COULD NOT FIND DEVELOPER DISK IMAGE解决方法(支持IOS9.2)
http://www.cnblogs.com/JackieHoo/p/5064757.html

Xcode 7真机测试详解
http://www.cnblogs.com/iCocos/p/4756626.html

使用Xcode 7 beta免费真机调试iOS应用程序
http://blog.k-res.net/archives/1862.html

Xcode 7 无证书真机测试
http://www.lidaze.com/2015/10/01/Xcode7zhenjiceshi/

1 0
原创粉丝点击