i trying achieve (that text written below wifi ssid):
this current code unable register nehotspothelper. have added network extension entitlement provisioning profile. not sure going wrong
let options = [ knehotspothelperoptiondisplayname : "free" ] let queue = dispatchqueue(label: "asad test", attributes: dispatchqueue.attributes.concurrent) _ = nehotspothelper.register(options: options [string : nsobject], queue: queue, handler: {(cmd: nehotspothelpercommand) -> void in // 2-- evaluate state if cmd.commandtype == .evaluate { let list1 = cmd.network! // print("evaluation required high") let connectednetwork = list1 // print("supported network interface: \(connectednetwork)") connectednetwork.setconfidence(.high) let response = cmd.createresponse(.success) response.setnetwork(connectednetwork) response.deliver() } // 1 -- scan list of wif if let list = cmd.networklist, cmd.commandtype == .filterscanlist { var isfree = 0 var networks = [nehotspotnetwork]() network in list { if self.currentssid.contains("free") || self.currentssid.contains("free") { // if free found add helper him print("created \(network.ssid)") network.setconfidence(.high) //network.setpassword("f4dd6657") networks.append(network) isfree = 1 } } if isfree == 1 { let response = cmd.createresponse(.success) response.setnetworklist(networks) response.deliver() } } // 3---do authenticating process here e.g json processing if (cmd.commandtype == .authenticate) { print("authtication required") let response = cmd.createresponse(.success) response.deliver() //respond } });
Comments
Post a Comment