当我的应用程序将用户重定向到safari时(其他重定向也会发生,不仅仅是safari)
UIApplication.shared.open(URL ..)然后用户按下“返回到应用程序”按钮,应用程序重新开始,而不是在重定向之前继续。
我有一个设置表,当您按一个单元格时,重定向就会发生。(想象一个有“更多来自我们的应用程序”的手机)
我知道这不是默认的行为,所以我错过了一些在google上找不到的东西。有谁能给我指一篇文章或者有什么想法吗?提前谢谢。
“返回应用程序”按钮的屏幕截图

编辑:,如果这起作用,我不会使用故事板。因此,考虑到注释,也许我没有正确地设置导航控制器,所以没有层次结构堆栈?
基于@MaximSysenko的观察,当重定向发生时,应用程序停止/崩溃
这就是重定向发生的地方:
override public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch indexPath.section {
...
//appSpecific
case 1:
if (indexPath.row == 0) {
} else if (indexPath.row == 1) {
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "permissions"), object: nil)
//tableView.deselectRow(at: indexPath, animated: true)
}
...
case 3:
else if (indexPath.row == 1) {
let url = URL(string: "itms://itunes.apple.com/us/developer/some-id")
UIApplication.shared.open(url!, options: [:], completionHandler: nil)
tableView.deselectRow(at: indexPath, animated: true)
}发布于 2017-02-03 14:58:50
我怀疑您的Info.plist包含此键的真实值:
<key>UIApplicationExitsOnSuspend</key>这将导致您的应用程序完全退出时,它的背景。将这个键值设置为false,以便让您的应用程序通过从前台到后台的转换回到前台。
https://stackoverflow.com/questions/42025347
复制相似问题