我正在使用此代码来展示应用设置
- (IBAction)showSettings:(id)sender
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
我想在我的应用程序中显示设置,而不是跳转到iPhone设置。 有人可以帮忙吗?
修改:
我尝试在目标C中编写此代码:
UIAlertController *alertControll = [UIAlertController alertControllerWithTitle:@"Sad Face Emoji!"
message:@"The calendar permission was not authorized. Please enable it in Settings to continue."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:@"Settings"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:nil];
[alertControll addAction:settingsAction];
[alertControll addAction:cancelAction];
[self presentViewController:alertControll animated:YES completion:nil];
但仍然跳到iPhone设置