LaunchAgent (Mac) as peripheral doesn't show a pairing request.

The same code built in a regular Mac app (with UI) does get paired.

The characteristic properties are [.read, .write, .notify, .notifyEncryptionRequired] The characteristic permissions are [.readEncryptionRequired, .writeEncryptionRequired] My service is primary.

In the iOS app (central) I try to read the characteristic, but an error is reported: Error code: 5, Description: Authentication is insufficient.

What context is the agent running in? That is, what do you have set for LimitLoadToSessionType?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I don't set LimitLoadToSessionType. My launch agent is not a GUI app. I'm thinking that may be an issue.

I don't set LimitLoadToSessionType.

OK.

That’s actually good news, because it means that you’re at least running in the right session (the default is Aqua, that is, your agent runs in GUI login sessions).

My launch agent is not a GUI app.

Does it have a GUI app associated with it? If so, try setting the AssociatedBundleIdentifiers property in your launchd property list.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Since my original post, I have a gui launch agent now that acts as a bluetooth peripheral. While it doesn't present a window, it does present a system menu bar item. I have added the AssociatedBundleIdentifiers in my plists used by my SMAppService.agent call. My launch agent advertises a service with a characteristic that uses notifyEncryptionRequired.

After these changes, my iPhone app still gets this error when calling setNotifyValue: Error Domain=CBATTErrorDomain Code=15 "Encryption is insufficient." The error is reported in the didUpdateNotificationStateFor delegate callback.

LaunchAgent (Mac) as peripheral doesn't show a pairing request.
 
 
Q