Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift中的LaunchOptionsKey.location是否启动整个应用程序?_Ios_Swift_Core Location_Region Monitoring - Fatal编程技术网

Ios Swift中的LaunchOptionsKey.location是否启动整个应用程序?

Ios Swift中的LaunchOptionsKey.location是否启动整个应用程序?,ios,swift,core-location,region-monitoring,Ios,Swift,Core Location,Region Monitoring,我目前正在Swift中进行区域监视,检查用户是否在某个位置附近。我使用背景模式(位置)检查用户每移动50米的位置。这会唤醒我的应用程序,并在应用程序中提供位置键(application:UIApplication,didFinishLaunchingWithOptions launchOptions:[UIApplication.launchOptions key:Any]?) 在第一个viewController上,我还检查用户是否有工作的internet连接。如果没有,则会显示一条消息:“请

我目前正在Swift中进行区域监视,检查用户是否在某个位置附近。我使用背景模式(位置)检查用户每移动50米的位置。这会唤醒我的应用程序,并在
应用程序中提供位置键(application:UIApplication,didFinishLaunchingWithOptions launchOptions:[UIApplication.launchOptions key:Any]?)

在第一个viewController上,我还检查用户是否有工作的internet连接。如果没有,则会显示一条消息:“请确保您已连接到Internet。”

在过去的几天里,我注意到这条信息即使在我有工作连接的时候也会显示出来,但是当我在移动的时候,我的互联网是关闭的。因此,我认为应用程序被唤醒,然后在使用选项完成启动后指向第一个视图控制器

这可能吗?收集新位置时,我的应用程序是否“完全”启动?我是否可以在
didfishlaunchingwithoptions
中执行以下操作以防止出现这种情况:

if(launchOptions?[UIApplication.LaunchOptionsKey.location] != nil) {

    // handle new location that was sent, but don't launch the rest of the application

} else {

    // do all the regular stuff, such as setting keyWindow etc

}

或者这在某些情况下会引起麻烦?如果我自己打开应用程序,是否可以在其中包含位置键?

我只是想启动整个应用程序,否则重新打开应用程序时会出现黑屏(因为启动已经初始化)。因此,我现在要做的是,如果应用程序卡在“假”闪屏viewController上,我将进入前台,如果是这样,我将重新检查连接并从那里启动。

我只是认为我需要启动整个应用程序,否则当我重新打开应用程序时,我将进入黑屏(因为启动已经初始化)。所以我现在要做的是,检查应用程序是否卡在“假”闪屏viewController上,如果是,我会重新检查连接并从那里启动