12 Replies
      Latest reply: Mar 13, 2017 6:56 AM by keeshux RSS
      yarshure Level 1 Level 1 (0 points)

        Dose Today widget can admin packet tunnel vpn status? start or stop ?

         

        When I test , I found Today widget can't load container app packet tunnal config, then show Would Like to add VPN Config?

         

         

         

        extension NETunnelProviderManager {
            class func loadOrCreateDefaultWithCompletionHandler(completionHandler: ((NETunnelProviderManager?, NSError?) -> Void)?) {
                self.loadAllFromPreferencesWithCompletionHandler { (managers, error) -> Void in
                    if let error = error {
                        NSLog("Error: Could not load managers: %@", error)
                        if let completionHandler = completionHandler {
                            completionHandler(nil, error)
                        }
                        return
                    }
                   
                    if let managers = managers {
                        if managers.indices ~= 0 {
                            if let completionHandler = completionHandler {
                                print("manager enable:\(managers[0].enabled)")
                                completionHandler(managers[0], nil)
                            }
                            return
                        }
                    }
                   
                    let config = NETunnelProviderProtocol()
                    /
                    /
                    config.serverAddress = "240.84.1.24"
                   
                    let manager = NETunnelProviderManager()
                    manager.protocolConfiguration = config
                    manager.localizedDescription = "name"
                   
                  
                    manager.saveToPreferencesWithCompletionHandler({ (error) -> Void in
                        if let completionHandler = completionHandler {
                            if let error = error {
                                NSLog("Error: Could not create manager: %@", error)
                            }
                            completionHandler(manager, error)
                        }
                    })
                }
            }
        }
        
        • Re: Today widget admin packet tunnel vpn status?
          eskimo Apple Staff Apple Staff (6,270 points)

          Dose Today widget can admin packet tunnel vpn status?

          Hmmm, interesting question.  I suspect that this might not be possible but, before going any further, I want to make sure that you the entitlements of your Today widget are set correctly (that is, contain the necessary Network Extension special entitlements).  You can use the instructions in Debugging Entitlement Issues to confirm this.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Today widget admin packet tunnel vpn status?
              yarshure Level 1 Level 1 (0 points)

              eskimo

              Can't load container Create VPN Configreation

              Error: Could not create manager: Error Domain=NEVPNErrorDomain Code=5 "IPC failed"



              Can Add Another One Configration , Why Limit Today  widget IPC request ?

              I thinks Apple Should Open it

              thanks

              • Re: Today widget admin packet tunnel vpn status?
                yarshure Level 1 Level 1 (0 points)

                https://pbs.twimg.com/media/CdmzJeeUUAAgnim.jpg:large

                 

                Today entitlements have add entitlements same as container app, see about Image

                • Re: Today widget admin packet tunnel vpn status?
                  yarshure Level 1 Level 1 (0 points)

                  I found pluginType not same, is CFBundleIdentifier

                    • Re: Today widget admin packet tunnel vpn status?
                      eskimo Apple Staff Apple Staff (6,270 points)

                      Today entitlements have add entitlements same as container app, see about Image

                      Checking the entitlements file is not sufficient because it’s only one input to the code signing process.  You have to check the final entitlements that are baked into the app and each of its sub-executables.  The doc I referenced earlier shows how to do that.

                      I found pluginType not same, is CFBundleIdentifier

                      I don’t understand this.

                      Share and Enjoy

                      Quinn “The Eskimo!”
                      Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                      let myEmail = "eskimo" + "1" + "@apple.com"

                    • Re: Today widget admin packet tunnel vpn status?
                      yarshure Level 1 Level 1 (0 points)

                      Today widget can create VPN profile and start/stop VPN, so Today entitlements should not have problem

                       

                      but  Today widget can't load VPN profile which container create.

                      I check NETunnelProviderManager.protocolConfiguration result

                       

                          type = plugin
                          identifier = CBF776A6-EC60-4F28-B617-6CB347E84836
                          serverAddress = 240.84.1.24
                          identityDataImported = NO
                          proxySettings = {
                              autoProxyDiscovery = NO
                              autoProxyConfigurationEnabled = NO
                              HTTPEnabled = NO
                              HTTPSEnabled = NO
                              FTPEnabled = NO
                              SOCKSEnabled = NO
                              RTSPEnabled = NO
                              gopherEnabled = NO
                              excludeSimpleHostnames = NO
                              usePassiveFTP = YES
                          }
                          disconnectOnSleep = NO
                          disconnectOnIdle = NO
                          disconnectOnIdleTimeout = 0
                          disconnectOnWake = NO
                          disconnectOnWakeTimeout = 0
                          pluginType = com.yarshure.Surf.SurfToday
                          authenticationMethod = 0
                          reassertTimeout = 0
                          providerConfiguration = {
                              App = com.yarshure.Surf.SurfToday
                          }
                          providerBundleIdentifier = com.yarshure.Surf.PacketTunnel)
                      
                        • Re: Today widget admin packet tunnel vpn status?
                          yarshure Level 1 Level 1 (0 points)
                              type = plugin
                              identifier = B68A9975-F6A2-4528-A1DE-D66B5452860A
                              serverAddress = 240.84.1.24
                              identityDataImported = NO
                              proxySettings = {
                                  autoProxyDiscovery = NO
                                  autoProxyConfigurationEnabled = NO
                                  HTTPEnabled = NO
                                  HTTPSEnabled = NO
                                  FTPEnabled = NO
                                  SOCKSEnabled = NO
                                  RTSPEnabled = NO
                                  gopherEnabled = NO
                                  excludeSimpleHostnames = NO
                                  usePassiveFTP = YES
                              }
                              disconnectOnSleep = NO
                              disconnectOnIdle = NO
                              disconnectOnIdleTimeout = 0
                              disconnectOnWake = NO
                              disconnectOnWakeTimeout = 0
                              pluginType = com.yarshure.Surf
                              authenticationMethod = 0
                              reassertTimeout = 0
                              providerConfiguration = {
                                  App = com.yarshure.Surf
                              }
                              providerBundleIdentifier = com.yarshure.Surf.PacketTunne
                          

                           

                          container app

                          pluginType = com.yarshure.Surf

                          identifier = B68A9975-F6A2-4528-A1DE-D66B5452860A

                          today

                          pluginType = com.yarshure.Surf.SurfToday

                          identifier = CBF776A6-EC60-4F28-B617-6CB347E84836

                          not same


                          So I think is't API lmit


                          Thanks