UIAlertController ios7 下无法运行的问题

在ios8中使用

UIAlertController

当运行在ios7 下出现错误

dyld: Symbol not found: _OBJC_CLASS_$_UIAlertAction

解决办法:

第一步:

设置 General -> Linked Frameworks and Libraries 

-> add   UIKit.frameword (optional)

第二步:

 

 if UIDevice.currentDevice().systemVersion.hasPrefix("8.")

 

来判断版本使用不同的代码

 

成功解决

猜你喜欢

转载自20142014.iteye.com/blog/2103466