Packet Tunnel Network Extension dies unexpectedly with Xcode 10.2, Xcode 11b5 works

I am working on a VPN Packet Tunnel Network Extension. When I run it from Xcode 11b5 it works perfectly but if I run it from Xcode 10.2.1 the Tunnel Extension crashes. I have to check the Console for the device to see that is has crashed because Xcode does not point a crash has occured. What I see in the console is this (all is from the Network Extension, another target),


NEProvider objects cannot be instantiated from non-extension processes
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: A8EDB519-3197-4907-92E2-17DCE552D3A1)'
*** First throw call stack:
(0x21357a98c 0x2127539f8 0x2134f43f8 0x213469228 0x213f98dd4 0x213f98644 0x212fb8a38 0x212fb97d4 0x212f62324 0x212f62e40 0x212f6b4ac 0x21319a114 0x21319ccd4)
Failed to start extension com.me.MyApp.tunnel-extension: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.me.MyApp.tunnel-extension.apple-extension-service" UserInfo={NSDebugDescription=connection to service named com.me.MyApp.tunnel-extension.apple-extension-service}
Extension com.me.MyApp.tunnel-extension died unexpectedly

I have set up an Exception Breakpoint but it does not trigger and I am a bit stuck on what to do. As per I have read it might be related to an issue in the entitlements but I don't know if it runs on Xcode 11b5 why it shouldn't in Xcode 10?


Entitlements for my app


<dict>

<key>com.apple.developer.networking.networkextension</key>

<array>

<string>packet-tunnel-provider</string>

</array>

<key>com.apple.security.application-groups</key>

<array>

<string>group.com.me.MyApp</string>

</array>

</dict>

</plist>


And for my extension


<dict>

<key>com.apple.developer.networking.networkextension</key>

<array>

<string>packet-tunnel-provider</string>

</array>

<key>com.apple.security.application-groups</key>

<array>

<string>group.com.me.MyApp</string>

</array>

</dict>

</plist>

Accepted Reply

Lesson learned, you have to be very careful when using beta software 😮 (unexpected). Something might have got lost/whatever in the middle and caused my build process to crash also so I couldn't archive the app. Creating a new project from scratch and adding back my code solved it.

Replies

Lesson learned, you have to be very careful when using beta software 😮 (unexpected). Something might have got lost/whatever in the middle and caused my build process to crash also so I couldn't archive the app. Creating a new project from scratch and adding back my code solved it.