I have a flutter app that uses multiple firebase calls. When the live version of the mobile application on a real device opens from standby mode it says it has crashed and asks to report the crash. I have crashlytics and have read xcode crash logs. Here they are I am stuck on this issue and it is heavily effecting users. I have **** out the actual uuid and other info.
From Crashlytics
INTERNAL ASSERTION FAILED: Failed to commit transaction:
<LevelDbTransaction Backfill Indexes: 0 changes (0 bytes):> Failed: IO
error:
/var/mobile/Containers/Data/Application/775AB93F-A27D-4400-87C0-5316FCCA089F/Library/Application
Support/firestore/__FIRAPP_DEFAULT/********************/main/000038.log:
Operation not permitted (expected status.ok()) ```
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0xa248 __exceptionPreprocess
1 libobjc.A.dylib 0x17a68 objc_exception_throw
2 Foundation 0x546958 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3 FirebaseFirestore 0x45b74 (Missing UUID ********************************)
4 FirebaseFirestore 0x45644 (Missing UUID ********************************)
5 FirebaseFirestore 0x9926c (Missing UUID ********************************)
6 FirebaseFirestore 0x992fc (Missing UUID ********************************)
7 FirebaseFirestore 0xd0f50 (Missing UUID ********************************)
8 FirebaseFirestore 0xc701c (Missing UUID 8********************************)
9 FirebaseFirestore 0xdf108 (Missing UUID ********************************)
10 FirebaseFirestore 0x6b344 (Missing UUID ********************************)
11 FirebaseFirestore 0x6190 (Missing UUID ********************************)
12 FirebaseFirestore 0x147528 (Missing UUID ********************************)
13 libdispatch.dylib 0x3fdc _dispatch_client_callout
14 libdispatch.dylib 0x746c _dispatch_continuation_pop
15 libdispatch.dylib 0x1aa58 _dispatch_source_invoke
16 libdispatch.dylib 0xb56c _dispatch_lane_serial_drain
17 libdispatch.dylib 0xc1e0 _dispatch_lane_invoke
18 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread
19 libsystem_pthread.dylib 0xdf8 _pthread_wqthread
20 libsystem_pthread.dylib 0xb98 start_wqthread
From xcode
FirebaseFirestore: std::__1::enable_if<!(std::is_same<void, decltype(fp0())>::value), decltype(fp0())>::type firebase::firestore::local::Persistence::Run<firebase::firestore::local::LocalStore::CollectGarbage(firebas... + 64
I have tried persisting version
firebase_core_platform_interface: 4.5.1
I have tried turning on and off data to recreate it seems not to occur only spiratically when phone goes into standby.
My main is ....
Future main() async {
RenderErrorBox.backgroundColor = Colors.transparent;
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
Stripe.publishableKey = stripePublishableKey;
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.createNotificationChannel(channel);
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
alert: true,
badge: true,
sound: true,
);
FirebaseMessaging messaging = FirebaseMessaging.instance;
NotificationSettings settings = await messaging.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true,
); //initialise shared preferences PreferenceUtils.init();
runApp(const MyApp());
}
Formatted Crashlytics
Crashlyticsformat
XCODE CRASH LOG
enter image description here
make sure that binding has been initialized!
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
Related
I am working on my Apple Watch app. Most of my components use JSON and use the Swift Codable protocol to decode JSON.
Now I wanted to prepare my release, but I received a message by a Beta tester that the App was always crashing on his Series 3.
After I installed the TestFlight build on my Series 3 I could reproduce the issue.
The crash logs from TestFlight and the crash logs extracted from my iPhone indicate that the crash is happening while the JSON gets decoded.
I have rather complex JSON structures, but I did not do any changes to them since the last update. Furthermore, decoding JSON works fine on Xcode builds (also on Series 3) and on newer Apple Watches (Series 4 + 5). I am struggling to find out what could cause the issue.
I discovered a post in the Apple developer forums with a similar issue, but without a solution to it: https://forums.developer.apple.com/thread/124627
Here's a part of the Stacktrace of my crash log:
Date/Time: 2020-02-05 08:37:42.9924 +0100
Launch Time: 2020-02-05 08:37:40.0000 +0100
OS Version: Watch OS 6.1.2 (17S5792a)
Release Type: User
Baseband Version: 4.40.02
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x4d9aefc8 __pthread_kill + 8
1 libsystem_pthread.dylib 0x4da260be pthread_kill + 108
2 libsystem_c.dylib 0x4d9383a4 abort + 84
3 libswiftCore.dylib 0x6cffbade swift_vasprintf+ 2341598 (char**, char const*, char*) + 0
4 libswiftCore.dylib 0x6d00932c swift::TargetMetadata<swift::InProcess>::getGenericArgs+ 2396972 () const + 0
5 libswiftCore.dylib 0x6d00508c _swift_initClassMetadataImpl+ 2379916 (swift::TargetClassMetadata<swift::InProcess>*, swift::ClassLayoutFlags, unsigned long, swift::TypeLayout const* const*, unsigned long*, bool) + 28
6 libswiftCore.dylib 0x6d005c86 swift_initClassMetadata2 + 22
7 libswiftCore.dylib 0x6cfdc6fc type metadata completion function for _KeyedDecodingContainerBox + 50
8 libswiftCore.dylib 0x6d00a6c2 swift::MetadataCacheEntryBase<(anonymous namespace)::GenericCacheEntry, void const*>::doInitialization+ 2401986 (swift::ConcurrencyControl&, swift::MetadataCompletionQueueEntry*, swift::MetadataRequest) + 178
9 libswiftCore.dylib 0x6d003a0c swift_getGenericMetadata + 1124
10 libswiftCore.dylib 0x6cdf4210 KeyedDecodingContainer.init<A>+ 213520 (_:) + 40
11 libswiftFoundation.dylib 0x6d156e0a __JSONDecoder.container<A>+ 323082 (keyedBy:) + 678
12 libswiftFoundation.dylib 0x6d1a3a1c protocol witness for Decoder.container<A>+ 637468 (keyedBy:) in conformance __JSONDecoder + 18
13 libswiftFoundation.dylib 0x6d1592b6 protocol witness for Decoder.container<A>+ 332470 (keyedBy:) in conformance __JSONDecoder + 32
14 libswiftCore.dylib 0x6cfdb1cc dispatch thunk of Decoder.container<A>+ 2208204 (keyedBy:) + 24
15 WatchSonos WatchKit Extension 0x00440bf2 0x358000 + 953330
16 WatchSonos WatchKit Extension 0x0043d08c 0x358000 + 938124
17 libswiftCore.dylib 0x6cfdb156 dispatch thunk of Decodable.init+ 2208086 (from:) + 12
18 libswiftFoundation.dylib 0x6d16fbee __JSONDecoder.unbox_+ 424942 (_:as:) + 4014
19 libswiftFoundation.dylib 0x6d156816 JSONDecoder.decode<A>+ 321558 (_:from:) + 642
20 libswiftFoundation.dylib 0x6d22af98 dispatch thunk of JSONDecoder.decode<A>+ 1191832 (_:from:) + 28
21 WatchSonos WatchKit Extension 0x0045db0c 0x358000 + 1071884
22 WatchSonos WatchKit Extension 0x00461cce 0x358000 + 1088718
23 WatchSonos WatchKit Extension 0x00461bde 0x358000 + 1088478
24 WatchSonos WatchKit Extension 0x00420ffa 0x358000 + 823290
25 WatchSonos WatchKit Extension 0x00425914 0x358000 + 842004
26 libdispatch.dylib 0x4d851846 _dispatch_call_block_and_release + 10
27 libdispatch.dylib 0x4d8528b8 _dispatch_client_callout + 6
28 libdispatch.dylib 0x4d85c6b0 _dispatch_main_queue_callback_4CF + 868
29 CoreFoundation 0x4dcdbbaa __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 10
30 CoreFoundation 0x4dcd7c00 __CFRunLoopRun + 1832
31 CoreFoundation 0x4dcd723a CFRunLoopRunSpecific + 370
32 GraphicsServices 0x50aebcd0 GSEventRunModal + 96
33 UIKitCore 0x65c91580 UIApplicationMain + 1730
34 libxpc.dylib 0x4da73c80 _xpc_objc_main.cold.3 + 152
35 libxpc.dylib 0x4da649b0 _xpc_objc_main + 184
36 libxpc.dylib 0x4da668c4 xpc_main + 110
37 Foundation 0x4e56b0c6 +[NSXPCListener serviceListener] + 0
38 PlugInKit 0x556d726c 0x556c5000 + 74348
39 WatchKit 0x5cfe9afe WKExtensionMain + 62
40 WatchKit 0x5d09f020 main + 10
Here's the position in the code that crashes:
required public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
self.id = try values.decode(String.self, forKey: .id)
do {
if values.contains(.groups) {
let groups = try values.decode(Dictionary<String, SonosGroup>.self, forKey: .groups)
self.groups = groups
}
if values.contains(.players) {
let players = try values.decode(Array<SonosPlayer>.self, forKey: .players)
self.players = players
}
}catch let error {
print("Error decoding groups \(error)")
}
}
For me this looks like an Apple bug and I filed feedback for it, but this is no solution for the next release.
Does anyone know what's the difference between a TestFlight build and an Xcode release build?
I tried setting a different optimization level, disabling bitcode (not allowed for Apple Watch Apps) and I started replacing Codable with the good old JSONSerialization.
If anyone knows more about it, thank you for that.
Kind regards
Alex
I was having a very similar problem with Encodable and Decodable's in a swift package. Setting DEAD_CODE_STRIPPING = NO in my apps target fixed it. This seems to be a weird leftover of this bug:
https://bugs.swift.org/browse/SR-11564?focusedCommentId=51285&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-51285
I tried to get a web page in Kotlin/Native with iOS platform, but it didn't work.
Please tell me where is the problem.
I created the project with Gradle and build.gradle contains:
plugins {
id 'kotlin-multiplatform' version '1.3.21'
}
Here are the codes.
package sample
fun main(args: Array<String>) {
println(WebGateway.get("https://www.google.com/"))
}
package sample
import platform.Foundation.*
import platform.darwin.*
actual object WebGateway {
actual fun get(urlString: String): String {
val semaphore = dispatch_semaphore_create(0)
var components = NSURLComponents(urlString)
val url = components.URL
var result: String = ""
val config = NSURLSessionConfiguration.defaultSessionConfiguration()
config.waitsForConnectivity = true
config.timeoutIntervalForResource = 300.0
val session = NSURLSession.sessionWithConfiguration(
config, null, NSOperationQueue.mainQueue()
)
val task = session
.dataTaskWithURL(url!!) { nsData: NSData?, nsurlResponse: NSURLResponse?, nsError: NSError? ->
nsData?.run { result = toString() }
println(nsData)
dispatch_semaphore_signal(semaphore);
}
task.resume()
session.finishTasksAndInvalidate()
NSOperationQueue.mainQueue().waitUntilAllOperationsAreFinished()
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER)
return result
}
}
After building the application, main.kexe was created.
I expected the Google web page HTML is printed in standard output by executing the application.
But the actual is:
% ./main.kexe
It doesn't show anything.
The program stops at dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER).
After executing the application, task.state became NSURLSessionTaskStateCompleted, but the program doesn't show anything or finish.
When I changed the session to NSURLSession.sessionWithConfiguration(config), I got the following output.
% ./main.kexe
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared sample.WebGateway.$<anonymous>$FUNCTION_REFERENCE$0#f6f058e8 from other thread
at 0 main.kexe 0x000000010039c3c3 ThrowIllegalObjectSharingException + 595
at 1 main.kexe 0x00000001003b9d6d -[KotlinObjectHolder ref] + 141
at 2 main.kexe 0x00000001003c9524 platform_Foundation_kniBridge11046 + 148
at 3 main.kexe 0x00000001003ca18c __platform_Foundation_kniBridge11045_block_invoke + 108
at 4 CFNetwork 0x00007fff4cd80763 __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 19
at 5 CFNetwork 0x00007fff4cd8016c __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 172
at 6 Foundation 0x00007fff50243a47 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
at 7 Foundation 0x00007fff5024394e -[NSBlockOperation main] + 68
at 8 Foundation 0x00007fff50218f7a -[__NSOperationInternal _start:] + 686
at 9 Foundation 0x00007fff5024367f __NSOQSchedule_f + 227
at 10 libdispatch.dylib 0x00007fff7aef3d4f _dispatch_call_block_and_release + 12
at 11 libdispatch.dylib 0x00007fff7aef4dcb _dispatch_client_callout + 8
at 12 libdispatch.dylib 0x00007fff7aef75d8 _dispatch_continuation_pop + 427
at 13 libdispatch.dylib 0x00007fff7aef6c7a _dispatch_async_redirect_invoke + 718
at 14 libdispatch.dylib 0x00007fff7af02d1a _dispatch_root_queue_drain + 325
at 15 libdispatch.dylib 0x00007fff7af034b1 _dispatch_worker_thread2 + 90
at 16 libsystem_pthread.dylib 0x00007fff7b1346ee _pthread_wqthread + 619
at 17 libsystem_pthread.dylib 0x00007fff7b134415 start_wqthread + 13
zsh: abort ./main.kexe
When I changed session to NSURLSession.sharedSession(), the same error appeared.
Kotlin native expects the callback to be called on the main thread.
This is how the native HTTP request is implemented in Kotlin conf spinner app.
https://github.com/Kotlin/kotlinconf-spinner/blob/master/clients/ios/src/iosMain/kotlin/platformUtils.kt
I'm using CocoaPods with a React Native app. I've had various errors when running builds in the Xcode simulator. I don't have issues running it on my device. Here's one that I get when I have breakpoints enabled:
- (void)ensureOnJavaScriptThread:(dispatch_block_t)block
{
RCTAssert(_jsThread, #"This method must not be called before the JS thread is created");
The error here is green (yet breaking, thanks Xcode) and it says com.facebook.react.JavaScript (9): breakpoint 1.2
I get two errors when I disable breakpoints, this is one:
void Instance::loadApplication(std::unique_ptr<RAMBundleRegistry> bundleRegistry,
std::unique_ptr<const JSBigString> string,
std::string sourceURL) {
callback_->incrementPendingJSCalls();
SystraceSection s("Instance::loadApplication", "sourceURL",
sourceURL);
nativeToJsBridge_->loadApplication(std::move(bundleRegistry), std::move(string),
std::move(sourceURL));
}
with the red error on the callback_-> line reading EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
the second is this a signal SIGABRT error from this code:
int main(int argc, char * argv[]) {
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
I think i've fixed that issue before by enabling zombies. When I do that, I see this in the console:
2018-07-11 16:56:08.326 [info][tid:main][RCTRootView.m:293] Running application Mapp ({
initialProps = {
};
rootTag = 11;
})
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication setNetworkActivityIndicatorVisible:]
PID: 34682, TID: 5546845, Thread name: (none), Queue name: com.mixpanel.20e6d2c2b6c431dfecfdfaa100ec0a11.0x7fa94db06940.network, QoS: 0
Backtrace:
4 Mapp 0x0000000103a31dd9 -[MPNetwork updateNetworkActivityIndicator:] + 121
5 Mapp 0x0000000103a2ec09 -[MPNetwork flushQueue:endpoint:] + 985
6 Mapp 0x0000000103a2e7b0 -[MPNetwork flushEventQueue:] + 64
7 Mapp 0x0000000103a10418 __32-[Mixpanel flushWithCompletion:]_block_invoke + 312
8 libdispatch.dylib 0x000000010e3f47ab _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x000000010e3f57ec _dispatch_client_callout + 8
10 libdispatch.dylib 0x000000010e3fdbe5 _dispatch_queue_serial_drain + 1305
11 libdispatch.dylib 0x000000010e3fe4fa _dispatch_queue_invoke + 328
12 libdispatch.dylib 0x000000010e3fa344 _dispatch_queue_override_invoke + 726
13 libdispatch.dylib 0x000000010e40136c _dispatch_root_queue_drain + 664
14 libdispatch.dylib 0x000000010e401076 _dispatch_worker_thread3 + 132
15 libsystem_pthread.dylib 0x000000010e920169 _pthread_wqthread + 1387
16 libsystem_pthread.dylib 0x000000010e91fbe9 start_wqthread + 13
This to me is unreadable. I don't understand what's wrong. Reminder: this build runs without breaking errors on my device, even when breakpoints are enabled. Is this something I should worry about? Please help!
Because in your code UI API called on a background thread. So please disable the Main Thread Checker of xcode. it will work.
Edit Scheme --- > Diagonstics --- > Runtime API Checking ---> Main
Thread Checker (un-check this setting)
Note: Always update the UI inside below method on a background thread
Or
Put your [UIApplication setNetworkActivityIndicatorVisible:] Method inside DispatchQueue.main.async
DispatchQueue.main.async { // Correct
UIApplication.shared.isNetworkActivityIndicatorVisible = true // in swift 4
[UIApplication setNetworkActivityIndicatorVisible:]// in objective-C
}
https://developer.apple.com/documentation/code_diagnostics/main_thread_checker
I already set OS_ACTIVITY_MODE to disable, but after migrating to Xcode 9 there was some unwanted logs printing like the below.
Edit: I already referred Hide strange unwanted Xcode logs, but doesn't work for me in Xcode 9.
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication registerForRemoteNotifications]
PID: 1303, TID: 27861, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0
Backtrace:
4 N-Gal 0x000000010b058211 _T05N_Gal11AppDelegateC29registerForRemoteNotificationyyFySb_s5Error_pSgtcfU_ + 193
5 N-Gal 0x000000010b0574d3 _T0Sbs5Error_pSgIxyx_SbSo7NSErrorCSgIyByy_TR + 115
6 libdispatch.dylib 0x0000000111a4c3f7 _dispatch_call_block_and_release + 12
7 libdispatch.dylib 0x0000000111a4d43c _dispatch_client_callout + 8
8 libdispatch.dylib 0x0000000111a5595b _dispatch_queue_serial_drain + 1162
9 libdispatch.dylib 0x0000000111a562df _dispatch_queue_invoke + 336
10 libdispatch.dylib 0x0000000111a5207d _dispatch_queue_override_invoke + 733
11 libdispatch.dylib 0x0000000111a591f9 _dispatch_root_queue_drain + 772
12 libdispatch.dylib 0x0000000111a58e97 _dispatch_worker_thread3 + 132
13 libsystem_pthread.dylib 0x0000000111f141ca _pthread_wqthread + 1387
14 libsystem_pthread.dylib 0x0000000111f13c4d start_wqthread + 13
Couldn't register: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator}
Couldn't register: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator}
Couldn't register: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator}
22
Can Anyone help me to hide these logs....? Thanks in advance!
It's not just a log. It's a warning. [UIApplication registerForRemoteNotifications] must be called on the main thread. You should move call of this method to didFinishLaunchingWithOptions of your AppDelegate.
It's not an unwanted log.
You need to call registerForRemoteNotifications() in main thread.
Replace code as below.
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
if error == nil{
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
I have a custom keyboard for iOS that uses Firebase for analytics. The Firebase app configuration is done at the initializer with a dispatch_once clause with the token as a global variable.
var token: dispatch_once_t = 0
class KeyboardViewController: UIInputViewController {
// ..
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
dispatch_once(&token) {
FIRApp.configure()
} // line 90
}
// ..
}
This is working fine but I am receiving many crash reports that indicate crashes on many devices when the app is configured. I am stuck for days trying to figure out the cause. Here is a part of one of the crash reports stack trace:
Exception Type: EXC_CRASH (SIGQUIT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Quit: 3
Termination Reason: Namespace SIGNAL, Code 0x3
Terminating Process: launchd [1]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018fab6338 __semwait_signal_nocancel + 8
1 libsystem_c.dylib 0x000000018f9e20dc nanosleep$NOCANCEL + 200 (nanosleep.c:104)
2 libsystem_c.dylib 0x000000018fa0568c sleep$NOCANCEL + 44 (sleep.c:62)
3 libsystem_dnssd.dylib 0x000000018fa6e7d4 ConnectToServer + 832 (dnssd_clientstub.c:607)
4 libsystem_dnssd.dylib 0x000000018fa6ff44 DNSServiceCreateConnection + 76 (dnssd_clientstub.c:1785)
5 libsystem_network.dylib 0x000000018fb2d318 __nw_resolver_set_update_handler_block_invoke + 872 (resolver.m:1031)
6 libdispatch.dylib 0x000000018f9711c0 _dispatch_client_callout + 16 (object.m:455)
7 libdispatch.dylib 0x000000018f97e860 _dispatch_barrier_sync_f_invoke + 84 (queue.c:3457)
8 libsystem_network.dylib 0x000000018fb2ce78 nw_resolver_set_update_handler + 208 (resolver.m:1275)
9 SystemConfiguration 0x0000000190f8a16c __SCNetworkReachabilityRestartResolver + 260 (SCNetworkReachability.c:1711)
10 SystemConfiguration 0x0000000190f891c8 __SCNetworkReachabilitySetDispatchQueue + 764 (SCNetworkReachability.c:1823)
11 SystemConfiguration 0x0000000190f88ccc SCNetworkReachabilityScheduleWithRunLoop + 504 (SCNetworkReachability.c:1586)
12 CustomKeyboard 0x000000010013f630 -[FIRReachabilityChecker start] + 196
13 CustomKeyboard 0x000000010013abac -[FIRNetwork init] + 156
14 CustomKeyboard 0x0000000100132e28 -[FIRClearcutLogger init] + 416
15 CustomKeyboard 0x0000000100132c68 __35+[FIRClearcutLogger sharedInstance]_block_invoke + 36
16 libdispatch.dylib 0x000000018f9711c0 _dispatch_client_callout + 16 (object.m:455)
17 libdispatch.dylib 0x000000018f971fb4 dispatch_once_f + 56 (once.c:57)
18 CustomKeyboard 0x0000000100132c40 +[FIRClearcutLogger sharedInstance] + 108
19 CustomKeyboard 0x0000000100137214 +[FIRApp initClearcut] + 60
20 CustomKeyboard 0x0000000100136688 +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] + 132
21 CustomKeyboard 0x000000010013643c +[FIRApp configure] + 316
22 libdispatch.dylib 0x000000018f9711c0 _dispatch_client_callout + 16 (object.m:455)
23 libdispatch.dylib 0x000000018f971fb4 dispatch_once_f + 56 (once.c:57)
24 CustomKeyboard 0x00000001000e314c _TFC19CustomKeyboard22KeyboardViewControllercfT7nibNameGSqSS_6bundleGSqCSo8NSBundle__S0_ + 1500 (KeyboardViewController.swift:90)
25 CustomKeyboard 0x00000001000e3270 _TToFC19CustomKeyboard22KeyboardViewControllercfT7nibNameGSqSS_6bundleGSqCSo8NSBundle__S0_ + 112 (KeyboardViewController.swift:0)
26 UIKit 0x00000001971f7688 -[_UIViewServiceViewControllerOperator __createViewController:withContextToken:fbsDisplays:appearanceSerializedRepresentations:legacyAppearance:traitCollection:initialInterfaceOrientation:hostAccessibilityServerPort:canShowTextServices:replyHandler:] + 2216 (UIViewServiceViewControllerOperator.m:1732)
27 CoreFoundation 0x0000000190aee160 __invoking___ + 144
28 CoreFoundation 0x00000001909e1c3c -[NSInvocation invoke] + 284 (NSForwarding.m:2948)
29 CoreFoundation 0x00000001909e66ec -[NSInvocation invokeWithTarget:] + 60 (NSForwarding.m:3019)
Apparently, the call trace after calling FIRApp.configure() is going through system libraries.
One observation from the stack trace is that the crash has something to do with checking the reachability of the device. However, I tried to reproduce a scenario where there is no internet connection but it's working fine.
Please note that all the crashes are happening on iOS 10 and most of them on iPhone 6.
Any help to figure out the cause of the crashes would be appreciated.
It is not recommended to use Firebase Analytics in an extension as the SDK does not support extension well. App extensions have limited functionalities compared to a full app so Firebase Analytics may not work well under some conditions, like the network in this case. The team is looking into supporting extensions better later.
It seems like the network is not available on custom keyboard as stated by Apple
"By default, a keyboard has no network access and cannot share a
container with its containing app. To enable these things, set the
value of the RequestsOpenAccess Boolean key in the Info.plist file to
YES. Doing this expands the keyboard’s sandbox, as described in
Designing for User Trust."
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/CustomKeyboard.html#//apple_ref/doc/uid/TP40014214-CH16-SW1