7 Replies
      Latest reply on Jul 31, 2019 9:09 AM by SuperLinkMan
      kawa00 Level 1 Level 1 (0 points)

        Hi, I am working on a VPN app that use NEPacketTunnelProvider, the app has a Today Extension that allow me to control the VPN connection, start and stop the connection. I am able to load the NEVPNManager from Preferences in Today Extension, which is created in the Host app, and I am able to start the tunnel using this NEVPNManager.

         

        Everything is going well.

         

        But when I  make some changes to this loaded NEVPNManager in Today Extension, for example:

        manager.isOnDemandEnabled = true
        
        
        
        
        
        
        
        

         

        and try to save the manager, I got the following error:

        -[NEVPNManager saveToPreferenc:337  Failed to save configuration: Error Domain=NEVPNErrorDomain Code=1 "configuration type is wrong" UserInfo={NSLocalizedDescription=configuration type is wrong}
        
        
        
        
        
        
        
        

         

        I am pretty sure that the configuration is valid, at least the same code works in the Host app. And if I remove the above changes (modify properties, save to preferences), the code also works in Today Extension, which means I can start the vpn tunnel normally in Today Extension.

         

        So my question is, can I change the properties of NEVPNManager in Today Extension instead of the Host app, and save the changes to preferences, so that changes will take effect next time I start the tunnel? And how? if it's possible.

         

        Thanks!