Hello All:
I am working on an APP that connects to an IOT device via BLE Library, and I set a bunch of keys in my info.plist the library requires:
Privacy - Bluetooth Always Usage Description
Privacy - Bluetooth Peripheral Usage Description
Privacy - Local Network Usage Description
Privacy - Bluetooth Always Usage Description
Privacy - Location Always and When in Use Usage Description
Privacy - Location Always Usage Description
Privacy - Location Usage Description
Privacy - Location When In Use Usage Description
but when I start the App from XCode, it does not ask for the "Local Network" authorization, and in the Privacy settings on the iPhone the App is not listed on the Local Network Screen, nor does Local Network appear when I look at the App properties.
Can anyone make a suggestion?
Thanks!
Post
Replies
Boosts
Views
Activity
Hello all:
I am testing an app that uses a BLE library to connect to an IOT device. The Library requires both Bluetooth and Location services, so I added entries to the info.plist file. On my iPhone when I go into the App settings I see BT enabled, but under Privacy-Location Services, the App is not there. I am thinking I added the entries to info.plist incorrectly? Under "Information Property List" I added:
Privacy - Bluetooth Always Usage Description
Privacy - Location Always Usage Description
and then I also added:
Required Device Capabilities
Item 0: Bluetooth Low Energy
Item 1: Location Services
Thanks for any and all input
Hello all:I have a collectionview using a custom cell that has 2 buttons in each cell. I need to display an alert to the User when a button is tapped, and tried this:@IBAction func testButton_Tapped(_ sender: Any) { print("Test Button tapped") let alertController = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert) let defaultAction = UIAlertAction(title: "Close", style: .default, handler: nil) alertController.addAction(defaultAction) self.present(alertController, animated: true, completion: nil) }but I get an error: Value of type 'DeviceCell' has no member 'present'. Note the function works, I get the print statement.The alert does work if I put it in the ViewController extension here:func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath){}but it only works then if I tap the Cell itself, not the button.Any and all input is appreciated!John.
Hello all:I am getting JSON data from a URL and then putting it into an array, and then I need to get that data into an array of objects. Here is the struct and array (actual names hidden for confidentiality):struct sTest: Codable { var a: String var b: String var c: String var d: String var e: String var f: String var g: String }var sTestArray = [sTest]()and I get the data from the URL using this code snippetif let jsonObj = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? NSDictionary{ let theList: NSArray = jsonObj["data"] as! NSArrayand when I print the array in the Console, this is what I get:Success{ data = ( { a = "a value"; b = "b value"; c = "c value"; d = "d value"; e = "e value"; f = "f value"; g = "g value"; }, and there are 144 data elements.I am stuck on parsing this into the sTestArray. I have tried setting up a decoder, and also tried using array indexes, but no joy. Can anyone offer any assistance?Thanks in advance!John.
Hi all:I am working on a POC IOS app that needs to authtenticate to a SA+QL Server Azure database. I wrote a web service in .NET, also osted on Azure, and found some examples that let me write the code below in my IOS app. So when the user taps the login button, the function calls the submitPost code, and the line print("response: ", utf8Representation) prints the response to the console. The web service will return "Success" if the authentication creentials are valid, and I need to return this value back to the login button function so I can take action based on the result, but I've been struggling trying to figure out how. Can anyone offer a suggestion? Note this is just a POC so if this isn't the best way to do this I am not worried about it right now, just need this to work! Thanks for any and all input!Code in Login Function>>>let myPost = User(username: "User1", password: "PW") submitPost(post: myPost) { (error) in if let error = error { fatalError(error.localizedDescription) } }Submit function>>>func submitPost(post: User, completion:((Error?) -> Void)?) { var urlComponents = URLComponents() urlComponents.scheme = "https" urlComponents.host = "mysite1.azurewebsites.net" urlComponents.path = "/Authenticate" guard let url = urlComponents.url else { fatalError("Could not create URL from components") } var request = URLRequest(url: url) request.httpMethod = "POST" var headers = request.allHTTPHeaderFields ?? [:] headers["Content-Type"] = "application/json" request.allHTTPHeaderFields = headers let encoder = JSONEncoder() do { let jsonData = try encoder.encode(post) request.httpBody = jsonData print("jsonData: ", String(data: request.httpBody!, encoding: .utf8) ?? "no body data") } catch { completion?(error) } let config = URLSessionConfiguration.default let session = URLSession(configuration: config) let task = session.dataTask(with: request) { (responseData, response, responseError) in guard responseError == nil else { completion?(responseError!) return } if let data = responseData, let utf8Representation = String(data: data, encoding: .utf8) { print("response: ", utf8Representation) } else { print("no readable data received in response") } } task.resume() }