Swift 4 project in Xcode 9.2
I'm trying to use Firestore in a project. I've added the libraries and cut and pasted the sample code from the FireStore intro guide. But I'm getting an EXC_BAD_ACCESS and have not been able to figure out why. Here's the code I'm trying to run:
let db = Firestore.firestore()
var ref: DocumentReference? = nil
ref = db.collection("users").addDocument(data: [
"first": "Ada",
"last": "Lovelace",
"born": 1815
]) { err in
if let err = err {
print("Error adding document: \(err)")
} else {
print("Document added with ID: \(ref!.documentID)")
}
}
And here's a screen dump of the error:
ANyone have an idea as to what's going wrong?
Same problem over here. Everything used to work fine untill the last iOS SDK update. If I write data to firestore they are not shown in console, sometimes after a few minutes or a hour.
App crashes on this message every few minutes:
2018-01-09 10:10:17.284630+0100 spontRestaurantAppIos[18971:19308343] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: closeWithFinalState should only be called for a started stream that has an active delegate.'
I've contacted firestore support and this is what I got back:
Upon checking, this a known bug with our iOS SDK. This is now on our radar and our engineers are currently on it.
For any updates, please watch out on our release notes.
So I guess we'll just have to wait... anybody have other suggestions?
Also see this issue in github: https://github.com/firebase/firebase-ios-sdk/issues/596
In my case, I don't get a error for 4 minutes. Then it crashes with
2018-01-09 21:11:23.584982+1100 Crux[2671:334948] *** Assertion failure in -[FSTWriteStream closeWithFinalState:error:], third_party/firebase/ios/Source/Firestore/Source/Remote/FSTStream.m:348
Still no idea why.
I just figured out that the error was due to the database rules not allowing access. I opened up the rules to allow public read write and it's now working.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.