| 2016.4.22 - 南京 | ionic |
前提环境:假设已经在mac(OS X El Capitan 版本 10.11.2)上装好了Xcode7.2(7C68)和ionic环境
运行添加ios平台命令 ionic platform add ios
打开Xcode,导入项目
添加Apple ID:Xcode - Preferences - Accounts - +
添加成功后,在Apple IDs下单击选择刚才添加的Apple ID,可以看到右侧的Team Name后边的iOS和Mac都是free,,然后双击(或点击右下角的View Details…按钮)打开Team Name下的那条记录,在Signing Identities下点击iOS Development后边的create按钮,Xcode会自动在后台帮你生成Dev模式需要的certificate(Xcode7以前是没有这个自动生成的,需要手动工作),稍等片刻,完了之后点done
在项目target的General页的Identity->Team中选中刚才Apple ID对应的项,然后我选择了Deployment->Main Interface选项
运行,报异常
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是不需要开发者账号就可以真机测试的
参考文章: