XHMM / react-native-cloud-store

A react-native module for icloud drive
https://react-native-cloud-store.vercel.app/docs/install/with-crna
MIT License
68 stars 11 forks source link

[iOS] Some users experienced App crashes #23

Closed YaoHuiJi closed 1 year ago

YaoHuiJi commented 1 year ago

Hi,I received serval app crash reports from Test Flight, I am not sure but it seems some codes in the stack are related to react-native-cloud-store, like "CloudStoreModule.init() " and something else.

I'm not quite sure how users trigger these crashes, but according to 1 user's feedback, it seems to be caused by a piece of code calling "CloudStore.isICloudAvailable()", and this user disabled iCloud on his iPhone. But I also tried to disable iCloud & iCloud driver, the app still works well, no crash.

All 4 crashes happened on iOS 15(15.2, 15.3, 15.4, 15.5), I don't know if it's a coincidence or if it's just iOS15, but it didn't happen on my own iOS15 device, and it didn't happen on the Simulator too.

If you need more information, please let me know.

Here is one of the crash log, the full crash files is attached at the end.

Thread 51 Crashed:
0   libsystem_kernel.dylib          0x00000001b8094ae8 os_fault_with_payload + 8 (:-1)
1   libsystem_trace.dylib           0x000000019b32b1b8 _os_log_impl_flatten_and_send + 7716 (log.c:1688)
2   libsystem_trace.dylib           0x000000019b327b74 _os_log + 148 (log.c:2266)
3   libsystem_trace.dylib           0x000000019b32fcb0 _os_log_fault_impl + 24 (log.c:2302)
4   SyncedDefaults                  0x00000001acb06c40 -[SYDRemotePreferencesSource initWithApplicationID:storeID:shared:additionalSource:containerPath:storeType:].cold.1 + 52 (SYDRemotePreferencesSource.m:235)
5   SyncedDefaults                  0x00000001acaf91c0 -[SYDRemotePreferencesSource initWithApplicationID:storeID:shared:additionalSource:containerPath:storeType:] + 1400 (SYDRemotePreferencesSource.m:235)
6   Foundation                      0x00000001822125c8 -[NSUbiquitousKeyValueStore initWithBundleIdentifier:storeIdentifier:additionalStore:storeType:] + 348 (NSUbiquitousKeyValueStore.m:200)
7   Foundation                      0x00000001821f563c __41+[NSUbiquitousKeyValueStore defaultStore]_block_invoke + 24 (NSUbiquitousKeyValueStore.m:108)
8   libdispatch.dylib               0x0000000180623670 _dispatch_client_callout + 20 (object.m:560)
9   libdispatch.dylib               0x0000000180624f18 _dispatch_once_callout + 32 (once.c:52)
10  Foundation                      0x00000001821fce38 +[NSUbiquitousKeyValueStore defaultStore] + 64 (once.h:84)
11  刻意人生                            0x0000000102319a78 CloudStoreModule.init() + 284 (CloudStore.swift:27)
12  刻意人生                            0x0000000102319ce0 @objc CloudStoreModule.init() + 20 (<compiler-generated>:0)
13  刻意人生                            0x00000001021dea74 __115-[RCTModuleData initWithModuleClass:bridge:moduleRegistry:viewRegistry_DEPRECATED:bundleManager:callableJSModules:]_block_invoke + 16 (RCTModuleData.mm:117)
14  刻意人生                            0x00000001021deedc -[RCTModuleData setUpInstanceAndBridge:] + 164 (RCTModuleData.mm:191)
15  刻意人生                            0x00000001021df9dc -[RCTModuleData instance] + 244 (RCTModuleData.mm:406)
16  刻意人生                            0x00000001021dfb24 -[RCTModuleData gatherConstantsAndSignalJSRequireEnding:] + 96 (RCTModuleData.mm:450)
17  刻意人生                            0x00000001021dfc98 -[RCTModuleData exportedConstants] + 24 (RCTModuleData.mm:488)
18  刻意人生                            0x00000001021e47b4 facebook::react::RCTNativeModule::getConstants() + 24 (RCTNativeModule.mm:69)
19  刻意人生                            0x0000000102276774 facebook::react::ModuleRegistry::getConfig(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 200 (ModuleRegistry.cpp:155)
20  刻意人生                            0x00000001022d70fc facebook::react::JSINativeModules::createModule(facebook::jsi::Runtime&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 256 (JSINativeModules.cpp:82)
21  刻意人生                            0x00000001022d6f04 facebook::react::JSINativeModules::getModule(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&) + 264 (JSINativeModules.cpp:47)
22  刻意人生                            0x00000001022d5598 facebook::react::JSIExecutor::NativeModuleProxy::get(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&) + 248 (JSIExecutor.cpp:45)
23  hermes                          0x00000001032e8644 0x1032d4000 + 83524
24  hermes                          0x0000000103334e64 0x1032d4000 + 396900
25  hermes                          0x000000010331dcd8 0x1032d4000 + 302296
26  hermes                          0x000000010331b2b4 0x1032d4000 + 291508
27  hermes                          0x000000010335d40c 0x1032d4000 + 562188
28  hermes                          0x00000001032dce24 0x1032d4000 + 36388
29  hermes                          0x00000001032dcc9c facebook::hermes::HermesRuntime::evaluateJavaScriptWithSourceMap(std::__1::shared_ptr<facebook::jsi::Buffer const> const&, std::__1::shared_ptr<facebook::jsi::Buffer const> const&, std::__1::basic_... + 88 (:-1)
30  hermes                          0x00000001032ddd1c 0x1032d4000 + 40220
31  刻意人生                            0x00000001022a38fc facebook::jsi::RuntimeDecorator<facebook::jsi::Runtime, facebook::jsi::Runtime>::evaluateJavaScript(std::__1::shared_ptr<facebook::jsi::Buffer const> const&, std::__1::basic_string<char, std::__1::... + 28 (decorator.h:118)
32  刻意人生                            0x00000001022a38fc facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::evaluateJavaScript(std::__1::shared_ptr<facebook::jsi::... + 76 (decorator.h:530)
33  刻意人生                            0x00000001022d2668 facebook::react::JSIExecutor::loadBundle(std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::_... + 344 (JSIExecutor.cpp:157)
34  刻意人生                            0x0000000102279cc0 facebook::react::NativeToJsBridge::loadBundle(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook:... + 112 (NativeToJsBridge.cpp:146)
35  刻意人生                            0x0000000102279cc0 decltype(std::declval<facebook::react::NativeToJsBridge::loadBundle(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1... + 120 (invoke.h:394)
36  刻意人生                            0x0000000102279cc0 void std::__1::__invoke_void_return_wrapper<void, true>::__call<facebook::react::NativeToJsBridge::loadBundle(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<faceb... + 120 (invoke.h:487)
37  刻意人生                            0x0000000102279cc0 std::__1::__function::__alloc_func<facebook::react::NativeToJsBridge::loadBundle(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry... + 120 (function.h:185)
38  刻意人生                            0x0000000102279cc0 std::__1::__function::__func<facebook::react::NativeToJsBridge::loadBundle(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, s... + 144 (function.h:356)
39  刻意人生                            0x000000010227abf8 std::__1::__function::__value_func<void (facebook::react::JSExecutor*)>::operator()[abi:v160006](facebook::react::JSExecutor*&&) const + 24 (function.h:510)
40  刻意人生                            0x000000010227abf8 std::__1::function<void (facebook::react::JSExecutor*)>::operator()(facebook::react::JSExecutor*) const + 24 (function.h:1156)
41  刻意人生                            0x000000010227abf8 facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8::operator()() const + 48 (NativeToJsBridge.cpp:310)
42  刻意人生                            0x000000010227abf8 decltype(std::declval<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8&>()()) std::__1::__invoke[abi:v160006]<facebook::react::Nat... + 48 (invoke.h:394)
43  刻意人生                            0x000000010227abf8 void std::__1::__invoke_void_return_wrapper<void, true>::__call<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8&>(facebook::react... + 48 (invoke.h:487)
44  刻意人生                            0x000000010227abf8 std::__1::__function::__alloc_func<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8, std::__1::allocator<facebook::react::NativeTo... + 48 (function.h:185)
45  刻意人生                            0x000000010227abf8 std::__1::__function::__func<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8, std::__1::allocator<facebook::react::NativeToJsBrid... + 60 (function.h:356)
46  刻意人生                            0x00000001021d0840 std::__1::__function::__value_func<void ()>::operator()[abi:v160006]() const + 20 (function.h:510)
47  刻意人生                            0x00000001021d0840 std::__1::function<void ()>::operator()() const + 20 (function.h:1156)
48  刻意人生                            0x00000001021d0840 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74)
49  刻意人生                            0x00000001021db9b8 facebook::react::RCTMessageThread::tryFunc(std::__1::function<void ()> const&) + 24 (RCTMessageThread.mm:69)
50  刻意人生                            0x00000001021db784 std::__1::__function::__value_func<void ()>::operator()[abi:v160006]() const + 20 (function.h:510)
51  刻意人生                

Here is the full crash file from xcode: DXHYbz7OlsP870rAVqHxlK.xccrashpoint.zip

XHMM commented 1 year ago

Apologize for the late reply. From your error report, this crash may be caused by the calling of NSUbiquitousKeyValueStore.default in the init function while you didn't enabled the Key-value storage capability. (A similar issue from other repo)

A temporary workaround is to enable the Key-value storage capability like the reply said although you didn't use it.

And I will fix the unnecessary using of NSUbiquitousKeyValueStore in the next release when I am available.

XHMM commented 1 year ago

v0.11.0 has been released, this module won't call key-value or icloud related events internally anymore, it may solve your problem, please have a try.

YaoHuiJi commented 1 year ago

Thanks for your great work!