没有 SKTNavigationManager 的 Skobbler 后台模式
Skobbler background mode without SKTNavigationManager
我正在使用 Skobbler 导航 SDK 以 swift 语言开发一个 IOS 应用程序。
我尝试允许用户在后台模式(IPhone 锁定)下使用导航。
我有以下问题:
1) 不使用 SDKTools 和 SKTNavigationManager 是否可以这样做?我们只使用 SKMaps.frameworks 函数。
使用此配置,我无法使用 allowBackgroundNavigation
属性 SKTNavigationConfiguration 就像在演示中一样。
我设置
SKPositionerService.sharedInstance().worksInBackground = true
并允许 "location Update in BackgroundMode" 到 info.plist。不幸的是,updateCurrentLocation 没有在后台触发,导航也不起作用。
非常感谢您:-) !!
P.S。 : 我用官方库CCLocationManager在后台成功运行一段短代码。所以我的应用似乎配置正确...
抱歉..这不是答案,而是 "Same Problem"。 updatedCurrentLocation
应用程序在后台时不会调用。
以为我添加了更多代码以提供更多信息并可能找到原因:
我的代码:
SKPositionerService.sharedInstance().delegate = self
SKPositionerService.sharedInstance().worksInBackground = true
SKPositionerService.sharedInstance().automaticLocationUpdatePause = false
SKPositionerService.sharedInstance().startLocationUpdate()
还尝试将 SKPositionerService.sharedInstance().startLocationUpdate()
作为第一行。运气不好。
当我 运行 像这样在 SKPositionerService 旁边使用 CLLocationManager 时:
locManager = CLLocationManager()
locManager.desiredAccuracy = 10000
locManager.distanceFilter = 10000
locManager.allowsBackgroundLocationUpdates = true
locManager.pausesLocationUpdatesAutomatically = false
locManager.startUpdatingLocation()
updatedCurrentLocation
正在后台调用。
我在 运行 宁 2.5.0 时使用了这个,因为那个版本还没有 iOS9 准备好,但我认为 2.5.1 会。这当然是一个糟糕的解决方法,因为第二个位置管理器会耗尽电池。
难道在 SKPositionerService 实现中,当 SKPositionerService.sharedInstance().worksInBackground
设置为真时,您没有将 CLLocationManager().allowsBackgroundLocationUpdates
设置为真?
顺便说一句,我正在 运行发布 2.5.1 热修复 here。
btw2: 这个不能在模拟器中测试。即使应用程序为 'backgrounded',模拟器也会调用 updatedCurrentLocation
。我猜是因为模拟器并没有真正的 'background' 模式。
btw3:如果后台模式适用于 SDKTools 导航管理器,我会感到非常惊讶...使用这个 2.5.1。热修复)
此问题的修补程序可从此处下载:
ObjC:https://www.dropbox.com/s/ruk6at2fju0rdd7/SKMaps_2_5_1.zip?dl=0
Swift: https://www.dropbox.com/s/lgbdherhqzudy2a/SKMapsSwift_2_5_1.zip?dl=0
我正在使用 Skobbler 导航 SDK 以 swift 语言开发一个 IOS 应用程序。 我尝试允许用户在后台模式(IPhone 锁定)下使用导航。
我有以下问题:
1) 不使用 SDKTools 和 SKTNavigationManager 是否可以这样做?我们只使用 SKMaps.frameworks 函数。
使用此配置,我无法使用 allowBackgroundNavigation 属性 SKTNavigationConfiguration 就像在演示中一样。
我设置
SKPositionerService.sharedInstance().worksInBackground = true
并允许 "location Update in BackgroundMode" 到 info.plist。不幸的是,updateCurrentLocation 没有在后台触发,导航也不起作用。
非常感谢您:-) !!
P.S。 : 我用官方库CCLocationManager在后台成功运行一段短代码。所以我的应用似乎配置正确...
抱歉..这不是答案,而是 "Same Problem"。 updatedCurrentLocation
应用程序在后台时不会调用。
以为我添加了更多代码以提供更多信息并可能找到原因:
我的代码:
SKPositionerService.sharedInstance().delegate = self
SKPositionerService.sharedInstance().worksInBackground = true
SKPositionerService.sharedInstance().automaticLocationUpdatePause = false
SKPositionerService.sharedInstance().startLocationUpdate()
还尝试将 SKPositionerService.sharedInstance().startLocationUpdate()
作为第一行。运气不好。
当我 运行 像这样在 SKPositionerService 旁边使用 CLLocationManager 时:
locManager = CLLocationManager()
locManager.desiredAccuracy = 10000
locManager.distanceFilter = 10000
locManager.allowsBackgroundLocationUpdates = true
locManager.pausesLocationUpdatesAutomatically = false
locManager.startUpdatingLocation()
updatedCurrentLocation
正在后台调用。
我在 运行 宁 2.5.0 时使用了这个,因为那个版本还没有 iOS9 准备好,但我认为 2.5.1 会。这当然是一个糟糕的解决方法,因为第二个位置管理器会耗尽电池。
难道在 SKPositionerService 实现中,当 SKPositionerService.sharedInstance().worksInBackground
设置为真时,您没有将 CLLocationManager().allowsBackgroundLocationUpdates
设置为真?
顺便说一句,我正在 运行发布 2.5.1 热修复 here。
btw2: 这个不能在模拟器中测试。即使应用程序为 'backgrounded',模拟器也会调用 updatedCurrentLocation
。我猜是因为模拟器并没有真正的 'background' 模式。
btw3:如果后台模式适用于 SDKTools 导航管理器,我会感到非常惊讶...使用这个 2.5.1。热修复)
此问题的修补程序可从此处下载:
ObjC:https://www.dropbox.com/s/ruk6at2fju0rdd7/SKMaps_2_5_1.zip?dl=0
Swift: https://www.dropbox.com/s/lgbdherhqzudy2a/SKMapsSwift_2_5_1.zip?dl=0