Forum Xamarin.iOS

NEHotspotHelper.Register always returns false, never runs. VS for Mac breaks entitlements.

ChrisLamont.3643ChrisLamont.3643 USUniversity ✭✭

I am unable to get NEHotspotHelper.Register to ever work, regardless of distribution method (adhoc, store, or debug). Below is all the sample code and configuration needed to reproduce (beside you needing to get NetworkExtension entitlement enabled, which I have). All the code is located in AppDelegate.cs

First, I noticed that VisualStudio for Mac doesn't retain the setting below, and had to compile on Xamarin (stable branch.) The compiled info.plist has this entry present


Here is the archived-expanded-entitlements.xcent, located in the compiled output.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

This is my code. Is this delegate perhaps a weak reference and getting GC'd prior to being run?

  public override bool FinishedLaunching(UIApplication app, NSDictionary options)
            LoadApplication(new App());

            NetworkExtension.NEHotspotHelperOptions netOpts = new NetworkExtension.NEHotspotHelperOptions();
            //  should be no longer than 15 characters
            netOpts.DisplayName = new NSString("VIPCard network");

            DispatchQueue queue = new DispatchQueue("VIPCard", false);

            bool isAvail = NetworkExtension.NEHotspotHelper.Register(netOpts, queue,
                                                                     new NetworkExtension.NEHotspotHelperHandler(
                                                                         (NetworkExtension.NEHotspotHelperCommand cmd) =>


                List<NetworkExtension.NEHotspotNetwork> hotspotList = new List<NetworkExtension.NEHotspotNetwork>();
                    if (cmd.CommandType == NetworkExtension.NEHotspotHelperCommandType.Evaluate || cmd.CommandType == NetworkExtension.NEHotspotHelperCommandType.FilterScanList)
                        foreach (NetworkExtension.NEHotspotNetwork network in cmd.NetworkList)



                NetworkExtension.NEHotspotHelperResponse response = cmd.CreateResponse(NetworkExtension.NEHotspotHelperResult.Success);
            }  ));

            Console.WriteLine("Hotspot helper status: " + isAvail);

            return base.FinishedLaunching(app, options);


Files are attached... I would include mobileprovision, but that file extension isn't permitted, and I can't figure out a way to attach a .BIN file


  • ChrisLamont.3643ChrisLamont.3643 USUniversity ✭✭
    edited May 2017

    Got it working. Needed this in entitlements. VS for Mac is still messing up entitlements, so I'm using Xamarin Studio for now

      <key></key> <true/> 
Sign In or Register to comment.