Flutter: Firestore transaction crashes only on physical iOS device

早过忘川 提交于 2020-01-13 05:59:25

问题


I have a simple transaction that updates a Firestore document. It works correctly on Android devices, Android Emulators and iOS emulators, but crashes on a physical iOS device:

Firestore.instance.runTransaction((Transaction tx) async {
    DocumentSnapshot docSnapshot = await tx.get(docRef);

      tx.update(
        docRef,
        {
          'title':'A Title'
        },
      );
    }

Error:

-[NSError init] called; this results in an invalid NSError instance. It will raise an exception in a future release. Please call errorWithDomain:code:userInfo: or initWithDomain:code:userInfo:. This message shown only once.

Assertion failure in void firebase::firestore::core::Transaction::EnsureCommitNotCalled()(), /Users/path_to_app/ios/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/core/transaction.mm:198 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: A transaction object cannot be used after its update callback has been invoked. (expected !committed_)'

I'm not sure what the error means, and my Google quest has hit a dead-end. Really hoping someone can point out what the problem might be!

来源:https://stackoverflow.com/questions/56950990/flutter-firestore-transaction-crashes-only-on-physical-ios-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!