Reputation: 43
I use firebase in my swift app.
But, because google firebase is not sanctioned my our country (Iran), my app wont work without a VPN.
What should I do to solve this problem?
Below is the code I use for user signup with firebase:
Auth.auth().createUser(withEmail: textFieldLoginEmail.text!, password: textFieldLoginPassword.text!) { (user, error) in
if user != nil
{
print("succes")
}
else
{
if let myerror = error?.localizedDescription
{
print(myerror)
}
else
{
print("error")
}
}
}
Upvotes: 3
Views: 1589
Reputation: 8511
This is NOT an issue you can solve programmatically.
A VPN creates a private and encrypted web channel from your machine to a target machine located somewhere in the world, as if you were directly connected to a different web network.
When you are connected through a VPN, web servers such the ones your government might use might fail to recognize the target website (firebase) you are trying to access, thus granting your connection to pass.
When you are NOT connected to a VPN, these web server see that you are connecting to firebase, and they block your connection.
Whilst developing your application, you should keep using a VPN.
Upvotes: 1