react-native-unity-view: iOS crashes on launch in release builds only
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
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 13
- Comments: 57
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
This is how i fixed it (in a nutshell)
moduleNames()
(https://github.com/f111fei/react-native-unity-view/issues/79#issuecomment-465110101)@peterfei @mtostenson thanks again for your support.
@JanOwiesniak
#include "Classes/Unity/UnitySharedDecls.h"
to#include "Unity/UnitySharedDecls.h"
You’ll also need to remove references to DynamicLibEngineAPI-functions.h and DynamicLibEngineAPI.mm. More about that issue here. If this helps you too I’ll probably open a PR to fix those issues and add support for this Unity version.@mtostenson Have you solved in iOS12.1.4 ?I have the same issue at iphone XS MAX in ios 12.1.4. “Strip Linked Product” to NO, still crashed.
@JanOwiesniak I think you solved it. Thank you, I’ve been trying to fix this for quite a while.
@peterfei @mtostenson thanks for your help.
I will update react-native-unity-view to 1.3.3. and Unity to 2018.3.6. Let’s see if this fixes the issue. @mtostenson special thanks for the hotfixes for upcoming issue i will run into 😃
hello!