iOS app extension not loading

Antoine D 1 Reputation point
2021-12-07T11:54:22.517+00:00

Hello everyone, I'm currently facing issues developing an app permitting VPN connections on iPhone using Xamarin.iOS ...

My setup:

  • Visual Studio on Win10 (tried with VS19 community and VS22 community)
  • Remote Mac build host
  • Local iPhone 10 test device

What I did was:

  • Created a binding library for a native framework (OpenVPNAdapter) (which compiles succesfully)
  • Added reference for this binding library in a new app extension project (which compiles succesfully)
  • Updated app extension and app container info.plist and entitlements.plist so they match (matching CFBundleId, CFBundleVersion for info.plist, checked NSExtension fields for app extension info.plist, matching application-groups, ...)
  • Activated Mono interpreter on app extension and app container
  • Disabled Linking on app extension and app container
  • Set up correct provisioning profile for app extension, another one for app container
    • Added reference for App extension project, tried also adding reference for app extension built DLL

Now my project compiles, but when the extension should be called, it appears it is not registered.

Does anyone have any idea what I could be doing wrong ? I'm stuck here.

iPhone log:
Dec 7 12:35:39 [myDevice] Notice 23836 nesessionmanager Found 0 (0 active) registrations for com.ghost.GhostSurf.VPNExtension (com.apple.networkextension.packet-tunnel)

Debug log:
https://gist.github.com/dantoine/048f2df7b848dbcc0a3358b186bbde08

Verbose build log:
https://gist.github.com/dantoine/b7c6abc17d281654906cdaf73e17fc2b

What I'm thinking is that Visual Studio successfully compiles my app into an .IPA file, containing my extension DLL, but for some reasons it is not treated as an app extension. (Extension DLL size: 12kb, native library bindings size: 18mb, final app .IPA size: 52mb)

I tried updating solution start-up to extension project, but I then can not deploy it on my iPhone (Error: choose a valid local device).

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-12-07T15:42:02.543+00:00

    I believe your code requires the com.apple.security.cs.allow-jit entitlement, and this is not allowed for extensions which run in a hardened environment.

    You will probably need to wait until xamian fully supports compile to native, or switch to swift.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.