I’m using MongoDB and Stitch SDK (StitchSDK ver. 6.4.0) . My app for iPhone runs in debug mode but when I build it as release and install it via TestFlight, it crashes. I tried changing the optimisation level in the build settings , but no luck.
The part of the Device Log which refers to the Crashed Thread is the following:
Thread 8 name: Dispatch queue: com.apple.root.default-qos
Thread 8 Crashed:
0 bson 0x105f72748 bson_append_array + 120
1 MongoSwift 0x105829db0 Array.encode(to:forKey:) + 1388
2 MongoSwift 0x105829db0 Array.encode(to:forKey:) + 1388
3 MongoSwift 0x10582c484 protocol witness for BSONValue.encode(to:forKey:) in conformance [A] + 24
4 MongoSwift 0x10583ff50 specialized Document.init(dictionaryLiteral:) + 668
5 MongoSwift 0x10583c6b8 Document.init(dictionaryLiteral:) + 24
6 StitchCoreSDK 0x105d27788 CoreStitchServiceClientImpl.getCallServiceFunctionRequest(withName:withArgs:withTimeout:) + 220
7 StitchCoreSDK 0x105d27db0 CoreStitchServiceClientImpl.callFunction<A>(withName:withArgs:withRequestTimeout:) + 120
8 StitchCoreSDK 0x105d28414 protocol witness for CoreStitchServiceClient.callFunction<A>(withName:withArgs:withRequestTimeout:) in conformance CoreStitchServiceClientImpl + 16
9 StitchCoreRemoteMongoDBService 0x105bd06d0 CoreRemoteMongoReadOperation.executeRead() + 232
10 StitchCoreRemoteMongoDBService 0x105bd05cc CoreRemoteMongoReadOperation.toArray() + 12
11 StitchRemoteMongoDBService 0x105e8598c partial apply for closure #1 in RemoteMongoReadOperation.toArray(_:) + 28
12 StitchRemoteMongoDBService 0x105e859b0 partial apply for thunk for @escaping @callee_guaranteed () -> (@owned [A], @error @owned Error) + 24
13 StitchCore 0x105ae410c closure #1 in OperationDispatcher.run<A>(withCompletionHandler:_:) + 136
14 StitchCore 0x105ae3e44 thunk for @escaping @callee_guaranteed () -> () + 20
15 libdispatch.dylib 0x1844f91a4 _dispatch_call_block_and_release + 24
16 libdispatch.dylib 0x1844fa1a8 _dispatch_client_callout + 16
17 libdispatch.dylib 0x18449c1fc _dispatch_queue_override_invoke + 728
18 libdispatch.dylib 0x1844a943c _dispatch_root_queue_drain + 340
19 libdispatch.dylib 0x1844a9c38 _dispatch_worker_thread2 + 172
20 libsystem_pthread.dylib 0x1def1fe48 _pthread_wqthread + 224
21 libsystem_pthread.dylib 0x1def1f9f0 start_wqthread + 8
I hope someone can help me out!
I made a workaround to send everything as text (json stringify) to the function and then in the function convert it back to json. It is not perfect but it works. Here is some code if somebody wants to do the same, I also upgraded to realm, but the principle stays the same :