在我的App中打开应用程序设置包

时间:2015-08-03 11:10:28

标签: ios application-settings

我正在使用此代码来展示应用设置

- (IBAction)showSettings:(id)sender
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

}

enter image description here

我想在我的应用程序中显示设置,而不是跳转到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设置

0 个答案:

没有答案