Here is the top part of my podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'GoogleSignIn'
target 'QueueUpShareExtension' do
# Pods for QueueUpShareExtension
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'GoogleSignIn'
end
I'm working in an XCode ios Application Extension (Share Extension). I'm able to authenticate just fine but when I try to get documents or add a document within the same method, it's throwing the exception stack below. Does this have something to do with how I'm instantiating FirestoreSettings?
2019-02-12 23:48:58.769317-0500 QueueUpShareExtension[2043:7385258] *** Assertion failure in std::string firebase::firestore::remote::LoadGrpcRootCertificate()(), /Users/macmoto/Dropbox/AppDevelopment/FlutterApps/queue_up/ios/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/remote/grpc_root_certificate_finder_apple.mm:81
2019-02-12 23:48:58.792134-0500 QueueUpShareExtension[2043:7385258] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Could not load root certificates from the bundle. SSL cannot work. (expected path)'
*** First throw call stack:
(
0 CoreFoundation 0x0000000110e2c1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010fe12735 objc_exception_throw + 48
2 CoreFoundation 0x0000000110e2bf42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010f25d940 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 QueueUpShareExtension 0x000000010b39b7e5 _ZN8firebase9firestore4util8internal4FailEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 533
5 QueueUpShareExtension 0x000000010b39bea2 _ZN8firebase9firestore4util8internal4FailEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEES4_ + 1538
6 QueueUpShareExtension 0x000000010b382c96 _ZN8firebase9firestore6remote23LoadGrpcRootCertificateEv + 118
7 QueueUpShareExtension 0x000000010b3748d0 _ZNK8firebase9firestore6remote14GrpcConnection13CreateChannelEv + 96
8 QueueUpShareExtension 0x000000010b3743eb _ZN8firebase9firestore6remote14GrpcConnection16EnsureActiveStubEv + 267
9 QueueUpShareExtension 0x000000010b377045 _ZN8firebase9firestore6remote14GrpcConnection12CreateStreamEN4absl11string_viewERKNS0_4auth5TokenEPNS1_18GrpcStreamObserverE + 85
10 QueueUpShareExtension 0x000000010b3fb9c5 _ZN8firebase9firestore6remote11WriteStream16CreateGrpcStreamEPNS1_14GrpcConnectionERKNS0_4auth5TokenE + 101
11 QueueUpShareExtension 0x000000010b3e1cdf _ZN8firebase9firestore6remote6Stream26ResumeStartWithCredentialsERKNS0_4util8StatusOrINS0_4auth5TokenEEE + 351
12 QueueUpShareExtension 0x000000010b3e6b8e _ZZZN8firebase9firestore6remote6Stream18RequestCredentialsEvENK3$_0clERKNS0_4util8StatusOrINS0_4auth5TokenEEEENKUlvE_clEv + 142
13 QueueUpShareExtension 0x000000010b3e6aed _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZZN8firebase9firestore6remote6Stream18RequestCredentialsEvENK3$_0clERKNS4_4util8StatusOrINS4_4auth5TokenEEEEUlvE_EEEvDpOT_ + 45
14 QueueUpShareExtension 0x000000010b3e67b9 _ZNSt3__110__function6__funcIZZN8firebase9firestore6remote6Stream18RequestCredentialsEvENK3$_0clERKNS3_4util8StatusOrINS3_4auth5TokenEEEEUlvE_NS_9allocatorISE_EEFvvEEclEv + 41
15 QueueUpShareExtension 0x000000010b222c16 _ZNKSt3__18functionIFvvEEclEv + 102
16 QueueUpShareExtension 0x000000010b16adce _ZN8firebase9firestore4util10AsyncQueue15ExecuteBlockingERKNSt3__18functionIFvvEEE + 478
17 QueueUpShareExtension 0x000000010b16d957 _ZZN8firebase9firestore4util10AsyncQueue4WrapERKNSt3__18functionIFvvEEEENK3$_0clEv + 39
18 QueueUpShareExtension 0x000000010b16d91d _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0EEEvDpOT_ + 45
19 QueueUpShareExtension 0x000000010b16d6d9 _ZNSt3__110__function6__funcIZN8firebase9firestore4util10AsyncQueue4WrapERKNS_8functionIFvvEEEE3$_0NS_9allocatorISB_EES7_EclEv + 41
20 QueueUpShareExtension 0x000000010b222c16 _ZNKSt3__18functionIFvvEEclEv + 102
21 QueueUpShareExtension 0x000000010b1a4e31 _ZZN8firebase9firestore4util8internal13DispatchAsyncEPU28objcproto17OS_dispatch_queue8NSObjectONSt3__18functionIFvvEEEENK3$_0clEPv + 33
22 QueueUpShareExtension 0x000000010b1a4e08 _ZZN8firebase9firestore4util8internal13DispatchAsyncEPU28objcproto17OS_dispatch_queue8NSObjectONSt3__18functionIFvvEEEEN3$_08__invokeEPv + 24
23 libdispatch.dylib 0x0000000110b6254b _dispatch_client_callout + 8
24 libdispatch.dylib 0x0000000110b6901c _dispatch_lane_serial_drain + 720
25 libdispatch.dylib 0x0000000110b69b5f _dispatch_lane_invoke + 401
26 libdispatch.dylib 0x0000000110b729a8 _dispatch_workloop_worker_thread + 645
27 libsystem_pthread.dylib 0x0000000111eb9fd2 _pthread_wqthread + 980
28 libsystem_pthread.dylib 0x0000000111eb9be9 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
if let _ = FirebaseApp.app() {
// [START setup]
let settings = FirestoreSettings()
Firestore.firestore().settings = settings
// [END setup]
self.db = Firestore.firestore()
//TODO: Change signin method later to something more secure
Auth.auth().signIn(withEmail: "[email protected]", password: "f5ibZscPolrL@NC6eI62xQNIf") { (user, error) in
if let error = error {
print(error.localizedDescription)
}
else
{
self.db.collection("queue_item").getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
for document in querySnapshot!.documents {
print("\(document.documentID) => \(document.data())")
}
}
}
/*
var ref: DocumentReference? = nil
ref = self.db.collection("queue_item").addDocument(data: [
"url": urlToSave,
"timesQueued": 1,
"title": titleToSave,
"subtitle": "",
"cleared": false,
"commentFromQueuer": commentToSave!,
"viewed": true,
"queuedForUID": _currentUID,
"createdByUID": _currentUID,
"createdAt": Date()
]) { err in
if let err = err {
print("Error adding Queue Item: \(err)")
} else {
print("Queue Item added with ID: \(ref!.documentID)")
}
}*/
}
}
}
// Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
I found a few problems with this issue:
Duplicate of #2177
This doesn't have anything to do with how you've instantiating FirestoreSettings, which is entirely unrelated. The issue is that very early in Firestore initialization, we load a certificate bundle. That bundle needs to be available to find with NSBundle.
Your Podfile doesn't actually include FirebaseFirestore or Firebase/Firestore so it's not clear exactly how you're getting Firestore, but you clearly are getting it because your code is compiling :-).
gRPCCertificates.bundle in the FirebaseFirestore.framework.If you see gRPCCerticates.bundle in your build, the next step would be add a call to Firestore.enableLogging(true) and report back the log lines you see related to certificate loading.
This doesn't have anything to do with how you've instantiating
FirestoreSettings, which is entirely unrelated. The issue is that very early in Firestore initialization, we load a certificate bundle. That bundle needs to be available to find withNSBundle.Your
Podfiledoesn't actually includeFirebaseFirestoreorFirebase/Firestoreso it's not clear exactly how you're getting Firestore, but you clearly are getting it because your code is compiling :-).2177 is primarily about how Carthage-based builds run into trouble when the bundle isn't available where the code expects it. If you're using CocoaPods you should be getting the resources you need automatically. In particular, look for
gRPCCertificates.bundlein the FirebaseFirestore.framework.If you see
gRPCCerticates.bundlein your build, the next step would be add a call toFirestore.enableLogging(true)and report back the log lines you see related to certificate loading.
Thank you, Gil! Simply adding "pod 'Firebase/Firestore'" to both places in the podfile and then running pod install did the trick! Working perfectly now.
"pod 'Firebase/Firestore'" to both places in the podfile ? I find only one Podfile add get "pod 'Firebase/Firestore'" added. still error

"Both places" likely means both target specifications within the Podfile.
@burkaslarry "Both places in the Podfile" refers back to the Podfile posted in the issue description, where the author happened to include the dependencies twice.
If you're having difficulty please create a new issue, fully describing your environment and what you're trying to do.
Most helpful comment
This doesn't have anything to do with how you've instantiating
FirestoreSettings, which is entirely unrelated. The issue is that very early in Firestore initialization, we load a certificate bundle. That bundle needs to be available to find withNSBundle.Your
Podfiledoesn't actually includeFirebaseFirestoreorFirebase/Firestoreso it's not clear exactly how you're getting Firestore, but you clearly are getting it because your code is compiling :-).2177 is primarily about how Carthage-based builds run into trouble when the bundle isn't available where the code expects it. If you're using CocoaPods you should be getting the resources you need automatically. In particular, look for
gRPCCertificates.bundlein the FirebaseFirestore.framework.If you see
gRPCCerticates.bundlein your build, the next step would be add a call toFirestore.enableLogging(true)and report back the log lines you see related to certificate loading.