I have the following scenario: iOS app (peripheral) X OSX app (central)
- I instantiate my peripheral manager with CBPeripheralManagerOptionRestoreIdentifierKey.
- In my peripheral's didFinishLaunchingWithOptions I send a local notification after getting a peripheral with UIApplicationLaunchOptionsBluetoothPeripheralsKey (don't do anything with it)
- In my peripheral's willRestoreState I also trigger a notification (don't do anything other than that)
If my peripheral app is still running in the background before it gets killed due to memory pressure, I get messages from the OSX central just fine.
After the iOS app gets killed, when OSX central sends a message, both notifications mentioned above come through on iOS, but the message I was actually expecting doens't.
I've not resintantiated my peripheralManager at any moment, where and how should I do it? I only have one peripheralManager for the entire cycle of my app.
Any suggestions are welcome.
UPDATE:
if do
let options: Dictionary = [CBPeripheralManagerOptionRestoreIdentifierKey: "myId"]
peripheralManager = CBPeripheralManager(delegate: self, queue: nil, options: options)
in willRestoreState, my apps just lose connection