我的代码:
overide func viewDidLoad() {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "activeAgain", name: UIApplicationWillEnterForegroundNotification, object:nil)
}
func activeAgain() {
println("ActiveAgain") //Comes immediately
callSeparateFunction() //Takes 5s
}
为什么println立即出现,单独的函数调用最多需要5s?当应用程序回到前台时,我必须调用一个新函数。谢谢!