1

My project is using UIAlertController. It's work fine and i can build an IPA file on Xcode 6.1.

But when i'm trying build an IPA file on Xcode 5.1. It is not work because Xcode 5.1 cant find interface declaration for 'UIAlertController'. Any ideas?

P/S: sorry about my english.

TienLe
  • 614
  • 2
  • 9
  • 33

4 Answers4

2

It's not possible. UIAlertController was introduced in iOS 8 and only Xcode 6+ supports iOS 8+.

As Apple's docs on UIAlertController show the class is "Available in iOS 8.0 and later." Source below: https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIAlertController_class/index.html

Austen Chongpison
  • 3,966
  • 1
  • 20
  • 17
0

UIAlertViewController is new to iOS 8 and will only work when targeting iOS 8 and beyond. It is a replacement for UIActionSheet. If you code must be 7 compliant then you should likely use it or both.

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

This post shows how to detect different iOS versions

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

Community
  • 1
  • 1
madmik3
  • 6,975
  • 3
  • 38
  • 60
0

You can't.. UIAlertController is available with xcode 6 and ios 8. The compiler Xcode 5.1 didn't understand it will give error

Sunny Shah
  • 12,990
  • 9
  • 50
  • 86
0

Try this if you want to use UIAlertController along side UIAlertView or UIActionSheet for your iOS 6 and above project. It compiled for me in Xcode 7.3 as well as in 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.
}
Eddie
  • 86
  • 5