0

I am currently getting an API misuse error when scanning - I know exactly why this happens because I need to wait to verify that the state of the central manager is powered on.

My question comes from when my application is terminated by the system to free up memory. I imitate this by running a SIGKILL command on my app, but I am getting the API Misuse error as I try to queue up a scan for the future.

What should I be doing? I don't want to set up a pending connect command either as that will drain the battery of my peripheral too quickly. I want it to scan and then connect if the user agrees (which I have set up using notifications).

Thanks.

Eric Gao
  • 3,502
  • 2
  • 19
  • 29
  • You can't queue up scans. Restoration will restore only `connect` requests. There is no way to deterministically wake up your app to connect to the peripheral. You may start thinking about exchanging the roles. The iOS device should be the peripheral and the peripheral should be the central in the reconnection scenario. There are several solutions but the optimal depends on your requirements. – allprog Nov 04 '14 at 07:00
  • My current build seems to wake up when we've successfully scanned and discovered peripherals after I've specified the services I need. Does this mean that the app isn't really waking up on discovery, but I have some other method that is waking the app up? – Eric Gao Nov 04 '14 at 09:01
  • Sorry, I was a bit vague. The app is woken up on successful discovery, your observation is correct. But I was referring to restoration, which happens when the app was killed. The SIGKILL does just that, in which case your app should not be awaken. At least this never happened before iOS 8. Things may have changed, would be good to check out the truth. – allprog Nov 04 '14 at 21:35

0 Answers0