使用UIAlertController的项目。如何使用Xcode 5.1构建IPA文件?

时间:2014-09-29 04:17:44

标签: ios objective-c xcode ipa uialertcontroller

我的项目正在使用UIAlertController。它工作正常,我可以在Xcode 6.1上构建一个IPA文件。

但是当我尝试在Xcode 5.1上构建一个IPA文件时。它不起作用,因为Xcode 5.1无法找到' UIAlertController'的接口声明。有什么想法吗?

P / S:抱歉我的英语。

4 个答案:

答案 0 :(得分:2)

这是不可能的。 {8}引入了UIAlertController,只有Xcode 6+支持iOS 8 +。

正如Apple UIAlertController上的文档显示该课程“在iOS 8.0及更高版本中可用”。来源如下: https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIAlertController_class/index.html

答案 1 :(得分:0)

UIAlertViewController是iOS 8的新手,仅适用于iOS 8及更高版本。它是UIActionSheet的替代品。如果您的代码必须符合7,那么您应该使用它或两者兼而有之。

https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIActionSheet_Class/index.html#//apple_ref/occ/cl/UIActionSheet

这篇文章展示了如何检测不同的iOS版本

How can we programmatically detect which iOS version is device running on?

答案 2 :(得分:0)

你不能... UIAlertController可用于xcode 6和ios 8.编译器Xcode 5.1并不理解它会给出错误

答案 3 :(得分:0)

如果您想为iOS 6及更高版本的项目使用UIAlertController和UIAlertView或UIActionSheet,请尝试此操作。 它在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.
}
相关问题