question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS crashes on launch in release builds only

See original GitHub issue

Unity version: 2018.2.1f1 React native version: 0.57.8

When running straight out of XCode, it works fine. However, creating a release IPA file results in an immediate crash on launch. We use fastlane to generate an IPA for beta testing, so we don’t usually see this problem until then. I tested this using a blank react native project, and a blank unity project, and the crash is there. There are no useful crash logs unfortunately. Has anyone been able to publish an iOS release using this library?

Thanks

UPDATE: Setting “Strip Linked Product” to NO prevents this crash. However, this means the debug symbols are not removed and causes the app size to increase by 30-50%

FURTHER UPDATE The “Strip Linked Product” workaround does not appear to work for iOS 12.1.

Here is an issue I created in the react native repo that describes a possible solution.

Here’s the crash report:

Thread 7 name:  com.facebook.react.JavaScript
Thread 7 Crashed:
0   libsystem_kernel.dylib        	0x00000001fbbbd104 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001fbc3ca00 pthread_kill$VARIANT$armv81 + 296
2   libsystem_c.dylib             	0x00000001fbb14d78 abort + 140
3   libsystem_malloc.dylib        	0x00000001fbc11768 _malloc_put + 0
4   libsystem_malloc.dylib        	0x00000001fbc11924 malloc_report + 64
5   libsystem_malloc.dylib        	0x00000001fbc042d0 free + 376
6   libc++.1.dylib                	0x00000001fb1bf120 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string+ 258336 () + 32
7   UnityTest                     	0x0000000102de23a4 std::__1::__vector_base<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::~__vector_base() + 730020 (vector:451)
8   UnityTest                     	0x0000000103385214 facebook::react::ModuleRegistry::getConfig+ 6640148 (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 100
9   UnityTest                     	0x0000000103394168 facebook::react::JSCNativeModules::createModule+ 6701416 (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpaqueJSContext const*) + 292
10  UnityTest                     	0x0000000103393cc8 facebook::react::JSCNativeModules::getModule+ 6700232 (OpaqueJSContext const*, OpaqueJSString*) + 188
11  UnityTest                     	0x000000010338e85c OpaqueJSValue const* (*facebook::react::(anonymous namespace)::exceptionWrapMethod<&(facebook::react::JSCExecutor::getNativeModule(OpaqueJSValue*, OpaqueJSString*))>())(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSString*, OpaqueJSValue const**)::funcWrapper::call+ 6678620 (OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSString*, OpaqueJSValue const**) + 104
12  JavaScriptCore                	0x0000000203350404 JSC::JSCallbackObject<JSC::JSDestructibleObject>::getOwnPropertySlot+ 574468 (JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&) + 340
13  JavaScriptCore                	0x0000000203a354f0 llint_slow_path_get_by_id + 2008
14  JavaScriptCore                	0x0000000203328928 llint_entry + 11528
15  JavaScriptCore                	0x000000020332d134 llint_entry + 29972
16  JavaScriptCore                	0x000000020332d134 llint_entry + 29972
17  JavaScriptCore                	0x000000020332d134 llint_entry + 29972
18  JavaScriptCore                	0x000000020332d134 llint_entry + 29972
19  JavaScriptCore                	0x000000020332d134 llint_entry + 29972
20  JavaScriptCore                	0x0000000203325a1c vmEntryToJavaScript + 300
21  JavaScriptCore                	0x000000020399bfe4 JSC::Interpreter::executeProgram+ 7176164 (JSC::SourceCode const&, JSC::ExecState*, JSC::JSObject*) + 9620
22  JavaScriptCore                	0x0000000203b77218 JSC::evaluate+ 9122328 (JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, WTF::NakedPtr<JSC::Exception>&) + 316
23  JavaScriptCore                	0x000000020334e634 JSEvaluateScript + 472
24  UnityTest                     	0x000000010336dad0 facebook::react::evaluateScript+ 6544080 (OpaqueJSContext const*, OpaqueJSString*, OpaqueJSString*) + 80
25  UnityTest                     	0x000000010338c918 facebook::react::JSCExecutor::loadApplicationScript+ 6670616 (std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 528
26  UnityTest                     	0x0000000103392ba4 std::__1::__function::__func<facebook::react::NativeToJsBridge::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)::$_0, std::__1::allocator<facebook::react::NativeToJsBridge::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)::$_0>, void (facebook::react::JSExecutor*)>::operator()+ 6695844 (facebook::react::JSExecutor*&&) + 144
27  UnityTest                     	0x0000000103393ba8 std::__1::function<void (facebook::react::JSExecutor*)>::operator()+ 6699944 (facebook::react::JSExecutor*) const + 40
28  UnityTest                     	0x000000010330c9cc facebook::react::tryAndReturnError(std::__1::function<void + 6146508 ()> const&) + 24
29  UnityTest                     	0x0000000103302528 facebook::react::RCTMessageThread::tryFunc(std::__1::function<void + 6104360 ()> const&) + 24
30  CoreFoundation                	0x00000001fbfb6408 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
31  CoreFoundation                	0x00000001fbfb5d08 __CFRunLoopDoBlocks + 272
32  CoreFoundation                	0x00000001fbfb1220 __CFRunLoopRun + 2376
33  CoreFoundation                	0x00000001fbfb05b8 CFRunLoopRunSpecific + 436
34  UnityTest                     	0x00000001032e36a4 +[RCTCxxBridge runRunLoop] + 264
35  Foundation                    	0x00000001fcad73b0 __NSThread__start__ + 1040
36  libsystem_pthread.dylib       	0x00000001fbc412fc _pthread_body + 128
37  libsystem_pthread.dylib       	0x00000001fbc4125c _pthread_start + 48
38  libsystem_pthread.dylib       	0x00000001fbc44d08 thread_start + 4

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:57

github_iconTop GitHub Comments

3reactions
JanOwiesniakcommented, Jan 12, 2019

I had problems with iOS Ad-Hoc / App Store Builds too. The app crashed immediately without any useful logs. Setting some compiler flags in XCode worked for me. You could give it a try.

ios/rnunitydemo.xcodeproj/project.pbxproj

COPY_PHASE_STRIP = YES;
ENABLE_BITCODE = NO;
STRIP_INSTALLED_PRODUCT = NO;
2reactions
JanOwiesniakcommented, Feb 23, 2019

This is how i fixed it (in a nutshell)

  1. Remove node_modules
  2. Reinstall node_modues via yarn
  3. Update Unity from 2018.2.14f1 to 2018.3.6f1
  4. Build UnityExport
  5. Patch UnityExport (https://github.com/jiulongw/swift-unity/pull/120#issuecomment-456315250, https://github.com/f111fei/react-native-unity-view/issues/79#issuecomment-465819733)
  6. Update react-native-unity-view to 1.3.3
  7. Update react-native to 0.57.8
  8. Patch react-native moduleNames() (https://github.com/f111fei/react-native-unity-view/issues/79#issuecomment-465110101)

react-native info

  React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
      Memory: 1.18 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.15.0 - /usr/local/opt/node@8/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/opt/node@8/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 21, 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 26.0.2, 27.0.1, 27.0.3, 28.0.1, 28.0.3
        System Images: android-21 | Google APIs ARM EABI v7a, android-26 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5199772
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0
      react-native: 0.57.8 => 0.57.8

@peterfei @mtostenson thanks again for your support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sudden crash on launch from all TestFlight builds
We've been getting a crash on launch starting today from all processed builds from TestFlight. An identical build we submitted the day ...
Read more >
iOS app crash only when not debugging - Stack Overflow
In Build Settings, go to the LLVM compiler 4.2 - Code Generation section, look for the Optimization Level option and change the Release...
Read more >
[Answer]-App crashes in Release build but not in debug-swift
There are many reasons that an app might crash in release mode but not in debug mode (e.g. memory allocation differences showing up...
Read more >
Is your app crashing on TestFlight? Issues and potential ...
Debug vs. release build · Third-party dependencies · Compiler optimization · Deprecated objects · Bitcode · Different OS versions · Resubmission.
Read more >
Fixing React-Native android release build - wesionaryTEAM
Android release build crashes on launch but works fine in development mode. ... from android/app/src/main/assets if the file already exists or just run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found