[英]How to bring my Swift 3.2 application to front
这是Swift 3.2和xCode9中的一个简单Swifter应用程序。 它的工作。 但是我会在后台运行该应用程序时编写该应用程序,然后将其显示在前面,然后我将看到标准的白色屏幕。
这个想法的最佳方法是什么?
import UIKit
import AudioToolbox
import WatchKit
import Foundation
import Swifter
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let server = HttpServer()
server["/hello"] = {
var queryParamsInfo = ""
for (name, value) in $0.queryParams {
queryParamsInfo += "\(name) -> \(value)<br/>"
}
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
return .ok(.html("<h3>You asked for \(queryParamsInfo)</h3>"))
}
do {
try server.start()
print("Server is started")
while true {
}
}
catch {
print("Error!")
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
谢谢你的帮助!
这在iOS上是不可能的 。 只有在以下情况下,应用程序才能进入前台
您无法以编程方式将应用程序置于前台。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.