Firebase did not work on real devices (iOS)

I am installing Firebase in my iOS application. Everything works fine on the simulator, but on a real device it does not execute / does not return a query to my database.

I am trying to clean up a project, but nothing changes.

Do you have a solution?

EDIT: update with code

override func viewDidLoad() { super.viewDidLoad() // Setup Firebase self.ref = FIRDatabase.database().reference() self.ref.child("Database").observeEventType(.Value, withBlock: { (snapshot) in if snapshot.exists() { for rest in snapshot.children.allObjects as! [FIRDataSnapshot] { print(rest.value) } } else { } }) { (error) in print(error.localizedDescription) } } 
+6
source share
3 answers

There is no error in your code, I had the same problem. Here is what I did:

  • Just go to your project in the navigation bar on the left.

  • Go to Build Settings and scroll down to Build Options .

  • Change the Enable Bitcode to None .

Hope this works for you too!

+3
source

I found that if you logged in and uninstalled the application, then after you install the application again, you will still be logged in. I don’t know for sure, but I suggested that Firebase somehow binds the account cache to the Bundle Identifier, and not to local storage.

So the solution is simple, and it worked for me:

  • Remove APP from the real device.
  • Go to your project in the navigation bar.
  • On the General tab, change your Bundle ID, for example: "myApp.com" to "myApplication.com" or whatever you want.
  • Assembly and launch
  • Bingo! Your application should now interact well with Firebase again.
+1
source

I had the same problem and it happened due to Authentication . Authentication has been Enabled on Firebase , but I do not have Authenticate the user . Therefore, I could not read Node from the Firebase database .

0
source

All Articles