I am getting a runtime error that says:
[NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor:
in my code where the variable "task" is declared. I marked the line that generates the error with a comment.
let serviceConfiguration: AWSServiceConfiguration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: nil)
//create a pool
let configuration: AWSCognitoIdentityUserPoolConfiguration = AWSCognitoIdentityUserPoolConfiguration(clientId: "6n3mb6nu0ls9ttfapkl69uuvd3", clientSecret: "7vlgp2ip3ihov4on7n0v4sti88sj6tfsobqlop6qu5t3db07bo6", poolId: "us-east-1_d0Y5gS66r")
AWSCognitoIdentityUserPool.register(with: serviceConfiguration, userPoolConfiguration: configuration, forKey: "AlarmMusic")
pool = AWSCognitoIdentityUserPool(forKey: "AlarmMusic")
let alertMessage = "Please register in order to be able to use this app:"
let alertController = UIAlertController(title: "Register", message: alertMessage, preferredStyle: .alert)
alertController.addTextField(configurationHandler: nil)
alertController.addTextField(configurationHandler: nil)
alertController.addTextField(configurationHandler: nil)
let actionOK = UIAlertAction(title: "OK", style: .cancel) {
action in
var attributes = [AWSCognitoIdentityUserAttributeType]()
let email: AWSCognitoIdentityUserAttributeType = AWSCognitoIdentityUserAttributeType(name: "email", value: alertController.textFields?[2].text ?? "olea.gnolaum@gmail.com")
attributes.append(email)
let task: AWSTask<AWSCognitoIdentityUserPoolSignUpResponse> = self.pool.signUp(alertController.textFields?[0].text ?? "dbrower", password: alertController.textFields?[1].text ?? "Password@1989", userAttributes: attributes, validationData: nil).continueOnSuccessWith( block: {_ in return nil }) as! AWSTask<AWSCognitoIdentityUserPoolSignUpResponse> // ERROR OCCURS HERE!
print("task=", task)
let signUpResponse: AWSCognitoIdentityUserPoolSignUpResponse? = task.result
print("signUpResponse=", signUpResponse as Any)
let user: AWSCognitoIdentityUser? = signUpResponse?.user
print("user=", user as Any)
}
alertController.addAction(actionOK)
self.present(alertController, animated: true, completion: nil)
Here are the results in the debug window of the print statements:
task=
signUpResponse= nil
user= nil
I checked my user pool in AWS Cognito Console. It all checks out. I provided all the required information the user pool requires.
Here's a screenshot of the pool:
What is the cause of this error, and what do I need to look into in order to fix it?