关于iOS已弃用api和SDK

时间:2017-11-16 07:09:07

标签: ios api deprecated

关于弃用的api和SDK

UIAlertview可从iOS 2.0到iOS 9.0使用。从iOS 8.0 .XCode将警告使用UIAlertController。 但是当我将base sdk设置为iOS 10.3并将部署目标设置为iOS 7.1时,该应用程序将成功地从iOS 7.1运行到iOS 10.3设备。 当将基本sdk设置为iOS 10.3并将部署目标设置为iOS 10.0时,该应用程序也会成功运行,只有很多警告,但构建成功。

1 个答案:

答案 0 :(得分:0)

是的,它会起作用。但使用弃用的东西的坏习惯。请改用UIAlertController。  有一天它可能无法运作。谁知道Apple的决定。

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Title" message:@"Your Message." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

}];
[alert addAction:defaultAction];
[self presentViewController:alert animated:true completion:nil];