gpt4 book ai didi

ios - 暂停事件在 PhoneGap iPhone 中无法正常工作?

转载 作者:可可西里 更新时间:2023-11-01 05:15:43 27 4
gpt4 key购买 nike

这是我的代码

    //This is an event that fires when a PhoneGap application is put into the background.
document.addEventListener("pause", onPause, false);

//This is an event that fires when a PhoneGap application is retrieved from the background.
document.addEventListener("resume", onResume, false);

// Handle the pause event
function onPause(){
console.log("pause : app is put into background");
}


// Handle the resume event
function onResume() {
console.log("resume : app is put into foreground");
}

当我按下主页按钮时,控制台中没有日志,但是当我单击该应用程序(将其置于前台)时,我的日志是

2011-11-22 12:11:37.206 Event[644:207] [INFO] pause : app is put into background
2011-11-22 12:11:37.206 Event[644:207] [INFO] resume : app is put into foreground

不知道为什么前台来的时候会调用pause函数。
我做错了什么吗?

最佳答案

这是来自文档

iOS Quirks

In the pause handler, any calls that go through Objective-C will not work, nor will any calls that are interactive, like alerts. This means that you cannot call console.log (and its variants), or any calls from Plugins or the PhoneGap API. These will only be processed when the app resumes (processed on the next run-loop).

关于ios - 暂停事件在 PhoneGap iPhone 中无法正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8223020/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com