Hello guys,
I'm facing the same issue. I have tried to do it in a similar way that eskimo suggested.
I want to let the user know what is going on with some checks done in the PacketTunnelProvider. I'm calling sendProviderMessage from the app and have also implemented handleAppMessage in the PacketTunnelProvider. With every change of the checks in the PacketTunnelProvider I want to let the app know about the new state without having the app periodically request the state.
I tried to retain the completion block in the PacketTunnelProvider and call it when the change of the state occurs outside of the method but the extension crashed with Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1a1312858).
For testing purposes, I have made use of a Timer publisher that should simulate a subscriber for the checks.
override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
self.completionHandler = completionHandler
}
override init {
self.cancellable = Timer.publish(every: 5, on: .current, in: .default)
.autoconnect()
.sink(receiveValue: { output in
self.completionHandler?(nil)
})
}
Please, can you provide some guidance on how to approach this properly? Thank you so much!
Post
Replies
Boosts
Views
Activity
Thank you, Eskimo. The bug was filed under FB12082085