Crash running iOS/quickstarts/TranslateExample
After installing pods, running the Swift translate example project I almost immediately get the following crash, before any user interaction:
2020-06-06 13:58:06.597488+0200 TranslateExample[23887:3153991] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
Screenshot with stack trace and simulator:
Thanks! Could you paste the full stack trace? In the screenshot it's getting cut off 🙂
Sure:
2020-06-06 15:15:55.644194+0200 TranslateExample[24780:3210858] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23ecfa51 _CFThrowFormattedException + 194
3 CoreFoundation 0x00007fff23eda4a6 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.4 + 38
4 CoreFoundation 0x00007fff23e9b787 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 247
5 CoreFoundation 0x00007fff23e38e11 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
6 TranslateExample 0x0000000108a50be3 -[MLKConfigFetchHTTPClient requestWithInstallationInfo:] + 615
7 TranslateExample 0x0000000108a5050c -[MLKConfigFetchHTTPClient fetchWithInstallationInfo:logEventContext:completionHandler:] + 152
8 TranslateExample 0x0000000108a55b12 __35-[MLKRemoteConfig fetchAndActivate]_block_invoke_2 + 197
9 TranslateExample 0x0000000108a53123 -[MLKFirebaseInstallationOperation start] + 548
10 Foundation 0x00007fff25924a20 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
11 Foundation 0x00007fff25924540 __NSOQSchedule_f + 182
12 libdispatch.dylib 0x000000010b6214dc _dispatch_block_async_invoke2 + 83
13 libdispatch.dylib 0x000000010b612e8e _dispatch_client_callout + 8
14 libdispatch.dylib 0x000000010b6157a3 _dispatch_continuation_pop + 552
15 libdispatch.dylib 0x000000010b614bbb _dispatch_async_redirect_invoke + 771
16 libdispatch.dylib 0x000000010b624399 _dispatch_root_queue_drain + 351
17 libdispatch.dylib 0x000000010b624ca6 _dispatch_worker_thread2 + 135
18 libsystem_pthread.dylib 0x00007fff51c089f7 _pthread_wqthread + 220
19 libsystem_pthread.dylib 0x00007fff51c07b77 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Maybe better with an image since formatting wasn't so good:

Thanks! Filed internally as b/158400839.
(FYI, if you use triple backticks ("```") instead of single backticks, the newlines are preserved:)
2020-06-06 15:15:55.644194+0200 TranslateExample[24780:3210858] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23ecfa51 _CFThrowFormattedException + 194
3 CoreFoundation 0x00007fff23eda4a6 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.4 + 38
4 CoreFoundation 0x00007fff23e9b787 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 247
5 CoreFoundation 0x00007fff23e38e11 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
6 TranslateExample 0x0000000108a50be3 -[MLKConfigFetchHTTPClient requestWithInstallationInfo:] + 615
7 TranslateExample 0x0000000108a5050c -[MLKConfigFetchHTTPClient fetchWithInstallationInfo:logEventContext:completionHandler:] + 152
8 TranslateExample 0x0000000108a55b12 __35-[MLKRemoteConfig fetchAndActivate]_block_invoke_2 + 197
9 TranslateExample 0x0000000108a53123 -[MLKFirebaseInstallationOperation start] + 548
10 Foundation 0x00007fff25924a20 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
11 Foundation 0x00007fff25924540 __NSOQSchedule_f + 182
12 libdispatch.dylib 0x000000010b6214dc _dispatch_block_async_invoke2 + 83
13 libdispatch.dylib 0x000000010b612e8e _dispatch_client_callout + 8
14 libdispatch.dylib 0x000000010b6157a3 _dispatch_continuation_pop + 552
15 libdispatch.dylib 0x000000010b614bbb _dispatch_async_redirect_invoke + 771
16 libdispatch.dylib 0x000000010b624399 _dispatch_root_queue_drain + 351
17 libdispatch.dylib 0x000000010b624ca6 _dispatch_worker_thread2 + 135
18 libsystem_pthread.dylib 0x00007fff51c089f7 _pthread_wqthread + 220
19 libsystem_pthread.dylib 0x00007fff51c07b77 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The underlying issue has been fixed in the ML Kit SDK; the fix will be included in the next release.
In the mean time, I think this issue occurs only when the current Locale doesn't have a region. I've only been able to reproduce that in the simulator when when the locale is explicitly set to "English" instead of the system locale – on an actual iPhone the locale always has a region ("US", "UK", …). You might be able to work around the crash by setting the simulator locale to the system locale.
The fix for this has now been released in the latest version of ML Kit (0.61.0).