我的项目使用UIAlertController。它工作正常,我可以在Xcode 6.1上创建一个IPA文件。使用UIAlertController的项目。如何用Xcode 5.1构建IPA文件?
但是,当我想在Xcode 5.1上生成一个IPA文件。这是不行的,因为Xcode 5.1无法找到'UIAlertController'的接口声明。有任何想法吗?
P/S:抱歉我的英语。
我的项目使用UIAlertController。它工作正常,我可以在Xcode 6.1上创建一个IPA文件。使用UIAlertController的项目。如何用Xcode 5.1构建IPA文件?
但是,当我想在Xcode 5.1上生成一个IPA文件。这是不行的,因为Xcode 5.1无法找到'UIAlertController'的接口声明。有任何想法吗?
P/S:抱歉我的英语。
这是不可能的。 UIAlertController
在iOS 8中引入,只有Xcode 6+支持iOS 8+。
由于苹果在UIAlertController
上的文档显示该类为“可在iOS 8.0及更高版本中使用”。源代码如下: https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIAlertController_class/index.html
UIAlertViewController是iOS 8的新增功能,仅适用于iOS 8及更高版本。它是UIActionSheet的替代品。如果你的代码必须符合7,那么你应该使用它或两者兼而有之。
这篇文章展示了如何检测不同版本的IOS
How can we programmatically detect which iOS version is device running on?
你不能.. UIAlertController可在Xcode 6和iOS 8的编译器的Xcode 5.1没有理解它会给出错误
如果你想在UIAlertView或UIActionSheet中为你的iOS 6及以上的项目使用UIAlertController,试试这个。 它在Xcode 7.3和Xcode 5.1中为我编译。
Class UIAlertControllerClass = NSClassFromString(@"UIAlertController"); //So that Xcode 5 won't complain about not knowing what is UIAlertController.
if (UIAlertControllerClass)
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 //So Xcode 5 won't worry about your UIAlertController code since it was introduced in iOS 8.
//UIAlertController code goes here.
#endif
}
else
{
//UIAlertView or UIActionSheet code goes here.
}
是否有一个原因,你需要在Xcode 5.1中构建而不是Xcode 6.1? – 2014-09-29 04:23:40
你得到这个整理? – 2014-10-01 01:29:17
我想为iOS 6构建我的项目接受了iOS 6及以上版本。 – TienLe 2014-10-01 03:57:25