hi, eskimo:
PacketTunnelProvider's - stopTunnelWithReason: completionHandler: How long can I detect other things after the method is executed?Maybe some network requests.
hi, eskimo:
PacketTunnelProvider's - stopTunnelWithReason: completionHandler: How long can I detect other things after the method is executed?Maybe some network requests.
You’re not guaranteed to get any execution time after you call the completion handler passed to that method. If you need time here, you have two choices:
You can delay calling the completion handler (A).
You can set up an expiring activity (B). This is essentially the same as a
UIApplication
background task, but available to extensions. See my UIApplication Background Task Notes for more context.Overall, I’d recommend A. Even though I think that B will work, I’m still a uneasy about it because it exposes potential edge cases in the OS. For example, what happens if your extension is still running when the user starts the VPN again? Does that start the new instance of your provider in your existing extension process? Or in a second extension process? I actually don’t know what will happen (I suspect the latter) but I’m quite sure that this code path is not well trodden.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
thanks, I'll try A, and then reply