主要是解决上架的时候遇到的问题,顺便把LaunchImage的使用学习一下,一开始项目使用的xib做为启动页的,最近上架打包的时候报错,通不过,问题以下:html
ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 - New iPhone apps and app updates submitted must support the 4-inch display on iPhone 5 and must include a launch image referenced in the Info.plist under UILaunchImages with a UILaunchImageSize value set to {320, 568}. Launch images must be PNG files and located at the top-level of your bundle, or provided within each .lproj folder if you localize your launch images. Learn more about iPhone 5 support and app launch images by reviewing the 'iOS Human Interface Guidelines' at 'https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW5' and the 'iOS App Programming Guide' at 'https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/App-RelatedResources/App-RelatedResources.html#//apple_ref/doc/uid/TP40007072-CH6-SW12'."ios
一.添加启动图片 swift
LaunchImage添加不一样尺寸的图片,在设置中进行设置,以下图:app
二.拖入相应尺寸的图片,以本例子须要为例。ide
我试了一下这里的图片名字能够任意命名,不过格式必须为png格式,若是只是写个demo,也能够下载我所用的这套图片http://download.csdn.net/download/riven_wn/9196015。学习
640*960 (4/4s) 2X位置测试
640*1136 (5/5s/5c) R4位置动画
750*1334 (6) R4.7位置ui
1242*2208 (6 plus) R5.5位置spa
三.General里面的设置。
如图,Launch Image Source 要设置为LaunchImage,Launch Screen File的内容删除为空。
四.要把LaunchScreen.storyboard(低版本Xcode为LaunchScreen.xib)中的用做LaunchScreen的复选框勾选取消掉,如图。
到这里就大功告成了,so easy,不过有时候会出现第一次运行显示不正常的状况,通常把App删除从新run一遍就行了。
若是以为显示时间不能知足需求,能够添加此方法延长显示时间(此为Swift版本,oc相似)
override func viewDidLoad() { super.viewDidLoad() NSThread.sleepForTimeInterval(3.0)//延长3秒 }
(此为oc版本) - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { [NSThread sleepForTimeInterval:2.0]; //设置启动页面时间,系统默认1秒 }
另外,还有经常使用的利用LaunchScreen.xib(LaunchScreen.storyboard)加载启动页和广告,可参考:欢迎界面Launch Screen动态加载广告
补充:以前有人出现,用LaunchScreen.xib真机运行的时候出现黑屏的状况,在网上看到这篇文章说是图片名字的问题,我亲自试了一下,发现用launchScreen.png不定性的出现黑屏,因此也贴在这里供你们参考。
5、iOS设置LaunchScreen后真机启动画面为黑屏的解决办法
最近在Xcode7下作一个项目,因为还不适应LaunchScreen.storyboard,就把以前项目的LaunchScreen.xib拖进来当作启动界面。