I am building an iOS app with Ionic Vue and using Firebase as a DB.
When I am running my app in the browser as pure JS code everything works fine. All of my DB queries return data as expected. When I run the same app in Xcode simulator my queries stop working. The only query that seem to return any data to console is GetDocs and forEach(doc)
// Function to log Firestore data
const logFirestoreData = async () => {
try {
const querySnapshot = await getDocs(collection(db, "habits"));
querySnapshot.forEach((doc) => {
console.log(`Document ID: ${doc.id}, Data: ${JSON.stringify(doc.data())}`);
});
} catch (error) {
console.error("Error getting Firestore data:", error);
}
};
But the moment I change this query to be more intelligent to use Where or OnSnapshot it does not log any errors or return any data. I just have an empty app with no records.
- I tried to console log error but unless it’s just GetDocs that pull entire DB, nothing gets returend and no errors are logged.
- I ran CocoaPods intallation of firebase in Xcode
- I tried to change AppDelegate file to add Firebase initiatlisation there.
- I tried adding google file to Xcode directory.
- I tried updating infoplist file to add permissions for outside API requests