iOS-Proximity-SDK
iOS-Proximity-SDK copied to clipboard
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
I just implemented this simple method to fetch all available tags/zones
import UIKit import Parse import EstimoteProximitySDK
class HomeViewController: UIViewController {
let estimoteCloudCredentials = CloudCredentials(appID: "xxxxxxxx", appToken: "xxxxxxxxxxxxx")
var proximityObserver: ProximityObserver!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.tabBarController?.title = "HOME"
DispatchQueue.main.async {
self.loadNearByBeacons()
}
}
private func loadNearByBeacons(){
self.proximityObserver = ProximityObserver(
credentials: estimoteCloudCredentials,
onError: { error in
print("proximity observer error: \(error)")
})
let blueberryZone = ProximityZone(tag: "DevOffice", range: ProximityRange.custom(desiredMeanTriggerDistance: 1.0)!)
blueberryZone.onEnter = { zoneContext in
print("Entered near range of tag 'DevOffice'. DeviceIdentifier: \(zoneContext.deviceIdentifier)")
}
blueberryZone.onExit = { zoneContext in
print("Exited near range of tag 'DevOffice'. DeviceIdentifier: \(zoneContext.deviceIdentifier)")
}
blueberryZone.onContextChange = { contexts in
print("Now in range of \(contexts.count) contexts")
}
// ... etc. You can define as many zones as you need.
// Start proximity observation
//self.observe.startObserving([blueberryZone])
self.proximityObserver.startObserving([blueberryZone])
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.tabBarController?.title = "HOME"
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
I'm getting this crash while fetching NearbyTags from Cloud
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 457, TID: 60500, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4 libobjc.A.dylib 0x000000019c7476f4
can anyone please respond to this?
hey @vinodgleecus firstly sorry for not responding for so long! secondly: could you share bit more?
- does it happen all the time/sometimes?
- which version of the SDK are you using?
- do you get logs from Proximity SDK?
- are you 100% sure that you have at least one device with
DevOffice
tag?
Regards
yes it happens every time
pod 'EstimoteProximitySDK','~> 1.2.1'
no, I didn't any logs
yes Am 100% Sure
I too have same problem "Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]" in my current App Store app. @Estimote could you please fix this issue ASAP. I am using EstimoteProximitySDK (1.4.1) in my app. This weird bug in iPhone X and later devices making app stuck for a while....