gpt4 book ai didi

ios - 从后台回来查看

转载 作者:行者123 更新时间:2023-11-28 07:37:01 25 4
gpt4 key购买 nike

我在 Android 上有一个 webview,它始终检查是否有互联网从后台返回检查连接状态是否已更改如果它处于离线状态,应用程序会使用以下代码将用户发送到“重新连接并重试”屏幕:

protected void onResume() {
super.onResume();
mWebView.onResume();
if (isConnected(getApplicationContext())){
} else {
Intent i = new Intent(MainActivity.this, off.class);
startActivity(i);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
}
}

到目前为止,我已经为这个 webview 制作了一个 ios 版本,但是当应用程序从后台返回时我无法重现这个检查,我如何在 ios swift 中重现这个“onresume”? (检查连接状态的代码我已经有了)

最佳答案

在 AppDelegate 中使用以下方法:

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
print("Enter foreground")

}

关于ios - 从后台回来查看,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53084478/

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