Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS设备上使用React Native的Redux Persist时崩溃_Ios_React Native_Redux_Asyncstorage_Redux Persist - Fatal编程技术网

在iOS设备上使用React Native的Redux Persist时崩溃

在iOS设备上使用React Native的Redux Persist时崩溃,ios,react-native,redux,asyncstorage,redux-persist,Ios,React Native,Redux,Asyncstorage,Redux Persist,我一直在尝试在我正在构建的React本机应用程序中使用,但每当我这样做时,在iOS设备上运行时就会随机崩溃。在模拟器上运行时不会出现此问题。它发生在redux的版本4和版本5上 根据sentry.io,错误是: EXC\u主断点 fatalException 6,代码2390738480,子代码8 我已经在iOS 11的所有发布版本上测试过了。有时,在正常使用的几天内,错误似乎消失了,但随后它会再次出现,通常会重复出现。这种行为表明,只有当存储达到某个状态,或者存储变得太大时,才会发生崩溃。不

我一直在尝试在我正在构建的React本机应用程序中使用,但每当我这样做时,在iOS设备上运行时就会随机崩溃。在模拟器上运行时不会出现此问题。它发生在redux的版本4和版本5上

根据sentry.io,错误是:

EXC\u主断点
fatalException 6,代码2390738480,子代码8

我已经在iOS 11的所有发布版本上测试过了。有时,在正常使用的几天内,错误似乎消失了,但随后它会再次出现,通常会重复出现。这种行为表明,只有当存储达到某个状态,或者存储变得太大时,才会发生崩溃。不过,据我所知,情况并非如此——显然,异步存储在iOS上没有大小限制(与Android不同)

sentry.io堆栈跟踪似乎没有提供任何线索,但它仍然在这里:

JavaScriptCore 0x18e7fc630 bmalloc::Heap::allocateLarge(std::__1::lock_guard&, unsigned long, unsigned long) JavaScriptCore 0x18e7f9ea4 bmalloc::Allocator::allocateLarge(unsigned long) JavaScriptCore 0x18deb8a04 WTF::fastMalloc(unsigned long) JavaScriptCore 0x18dec9d50 WTF::StringImpl::createUninitialized(unsigned int, unsigned short*&) JavaScriptCore 0x18dec9bf8 WTF::StringBuilder::allocateBufferUpConvert(unsigned char const*, unsigned int) JavaScriptCore 0x18e7e76f0 WTF::StringBuilder::appendQuotedJSONString(WTF::String const&) JavaScriptCore 0x18e55a2cc JSC::Stringifier::appendStringifiedValue(WTF::StringBuilder&, JSC::JSValue, JSC::Stringifier::Holder const&, JSC::PropertyNameForFunctionCall const&) JavaScriptCore 0x18e55b354 JSC::Stringifier::Holder::appendNextProperty(JSC::Stringifier&, WTF::StringBuilder&) JavaScriptCore 0x18e55a5d4 JSC::Stringifier::appendStringifiedValue(WTF::StringBuilder&, JSC::JSValue, JSC::Stringifier::Holder const&, JSC::PropertyNameForFunctionCall const&) JavaScriptCore 0x18e5594e0 JSC::Stringifier::stringify(JSC::Handle) JavaScriptCore 0x18e55d804 JSC::JSONProtoFuncStringify(JSC::ExecState*) JavaScriptCore 0x18e5f34c8 llint_entry JavaScriptCore 0x18e5f2a94 llint_entry JavaScriptCore 0x18e5f2a94 llint_entry JavaScriptCore 0x18e5f2a94 llint_entry JavaScriptCore 0x18e5f2a30 llint_entry JavaScriptCore 0x18e5f2ee0 llint_entry JavaScriptCore 0x18e5f2a30 llint_entry JavaScriptCore 0x18e5f2a94 llint_entry JavaScriptCore 0x18e5f2a30 llint_entry JavaScriptCore 0x18e5ebf50 llintPCRangeStart JavaScriptCore 0x18e4d1b94 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) JavaScriptCore 0x18def71b8 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) JavaScriptCore 0x18e506c3c JSC::boundThisNoArgsFunctionCall(JSC::ExecState*) JavaScriptCore 0x18e5ec098 vmEntryToNative JavaScriptCore 0x18def7200 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) JavaScriptCore 0x18e14a1fc JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) JavaScriptCore 0x18def6f68 JSObjectCallAsFunction rizzle 0x1013eca4c facebook::react::Object::callAsFunction(OpaqueJSValue*, int, OpaqueJSValue const* const*) const rizzle 0x10140c76c facebook::react::JSCExecutor::callFunction(std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, folly::dynamic const&) at setJSResponder(node_modules/react-native-sentry/lib/NativeClient.js:155:29) at onChange(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:3241:23) at setResponderAndExtractTransfer(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:3354:140) at extractEvents(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:3463:85) at extractEvents(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:2971:54) at fn(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:3201:47) at batchedUpdates(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:2448:20) at batchedUpdates(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:198:16) at _receiveRootNodeIDEvent(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:3221:32) at apply(node_modules/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:3234:37) at fn(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:299:42) at __guard(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:262:7) at value(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:110:10) rizzle 0x10140bb00 std::__1::function::operator()(OpaqueJSContext*) const rizzle 0x10139a110 facebook::react::tryAndReturnError(std::__1::function const&) rizzle 0x1013923a8 facebook::react::RCTMessageThread::tryFunc(std::__1::function const&) CoreFoundation 0x18756016c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ CoreFoundation 0x18755fa3c __CFRunLoopDoBlocks CoreFoundation 0x18755dca4 __CFRunLoopRun CoreFoundation 0x18747e2d8 CFRunLoopRunSpecific rizzle 0x101374c48 +[RCTCxxBridge runRunLoop] Foundation 0x187fa7860 __NSThread__start__ libsystem_pthread 0x1871e432c _pthread_body libsystem_pthread 0x1871e41f8 _pthread_start JavaScriptCore 0x18e7fc630 bmalloc::Heap::allocateLarge(std::_1::lock\u guard&,unsigned long,unsigned long) JavaScriptCore 0x18e7f9ea4 bmalloc::Allocator::allocateLarge(无符号长) JavaScriptCore 0x18deb8a04 WTF::fastMalloc(无符号长) JavaScriptCore 0x18dec9d50 WTF::StringImpl::createUninitialized(无符号int、无符号short*&) JavaScriptCore 0x18dec9bf8 WTF::StringBuilder::allocateBufferUpConvert(无符号字符常量*,无符号整数) JavaScriptCore 0x18e7e76f0 WTF::StringBuilder::appendQuotedJSONString(WTF::String常量&) JavaScriptCore 0x18e55a2cc JSC::Stringifier::appendStringifiedValue(WTF::StringBuilder&,JSC::JSC::Stringifier::Holder常量&,JSC::PropertyNameForFunctionCall常量&) JavaScriptCore 0x18e55b354 JSC::StringGiver::Holder::appendNextProperty(JSC::StringGiver&,WTF::StringBuilder&) JavaScriptCore 0x18e55a5d4 JSC::Stringifier::appendStringifiedValue(WTF::StringBuilder&,JSC::JSC::JSValue,JSC::Stringifier::Holder常量&,JSC::PropertyNameForFunctionCall常量&) JavaScriptCore 0x18e5594e0 JSC::Stringifier::stringify(JSC::Handle) JavaScriptCore 0x18e55d804 JSC::JSONProtoFuncStringify(JSC::ExecState*) JavaScriptCore 0x18e5f34c8 llint_条目 JavaScriptCore 0x18e5f2a94 llint_条目 JavaScriptCore 0x18e5f2a94 llint_条目 JavaScriptCore 0x18e5f2a94 llint_条目 JavaScriptCore 0x18e5f2a30 llint_条目 JavaScriptCore 0x18E5F20 EELLINT_条目 JavaScriptCore 0x18e5f2a30 llint_条目 JavaScriptCore 0x18e5f2a94 llint_条目 JavaScriptCore 0x18e5f2a30 llint_条目 JavaScriptCore 0x18e5ebf50 llintPCRangeStart JavaScriptCore 0x18e4d1b94 JSC::JITCode::execute(JSC::VM*,JSC::ProtoCallFrame*) JavaScriptCore 0x18def71b8 JSC::解释器::executeCall(JSC::ExecState*,JSC::JSObject*,JSC::CallType,JSC::CallData常量&,JSC::JSC::JSValue,JSC::ArgList常量&) JavaScriptCore 0x18e506c3c JSC::boundThisNoArgsFunctionCall(JSC::ExecState*) JavaScriptCore 0x18e5ec098 vmEntryToNative JavaScriptCore 0x18def7200 JSC::解释器::executeCall(JSC::ExecState*,JSC::JSObject*,JSC::CallType,JSC::CallData常量&,JSC::JSC::ArgList常量&) JavaScriptCore 0x18e14a1fc JSC::profiledCall(JSC::ExecState*,JSC::ProfilingReason,JSC::JSValue,JSC::CallType,JSC::CallData常量&,JSC::JSC::ArgList常量&) JavaScriptCore 0x18def6f68 JSObjectCallAsFunction rizzle 0x1013eca4c facebook::react::Object::callAsFunction(OpaqueJSValue*,int,OpaqueJSValue常量*const*)常量 rizzle 0x10140c76c facebook::react::JSCExecutor::callFunction(std::\uuu1::basic\u字符串,std:\uuu1::分配器>常量&,std:\uu1::basic\u字符串,std::\uuuu1::分配器>常量&,富利::动态常量&) 在setJSResponder(node_modules/react native sentry/lib/NativeClient.js:155:29) 立即更改(节点\模块/react native/Libraries/Renderer/react nativefiber-prod.js:3241:23) 在setResponderAndExtractTransfer(节点_modules/react native/Libraries/Renderer/ReactNativeFiber-prod.js:3354:140) 在extractEvents(节点\模块/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:3463:85) 在extractEvents(节点\模块/react-native/Libraries/Renderer/ReactNativeFiber-prod.js:2971:54) 在fn(节点_模块/react native/Libraries/Renderer/react nativefiber-prod.js:3201:47) 在批处理更新(节点\模块/react native/Libraries/Renderer/ReactNativeFiber-prod.js:2448:20) 在批处理更新(节点\模块/react native/Libraries/Renderer/ReactNativeFiber-prod.js:198:16) 在_receiveRootNodeIDEvent(节点_modules/react native/Libraries/Renderer/react nativefiber-prod.js:3221:32) 应用时(node_modules/react native/Libraries/Renderer/ReactNativeFiber-prod.js:3234:37) 在fn(node_modules/react native/Libraries/BatchedBridge/MessageQueue.js:299:42) at_uuuGuard(node_modules/react native/Libraries/BatchedBridge/MessageQueue.js:262:7) at值(node_modules/react native/Libraries/BatchedBridge/MessageQueue.js:110:10) rizzle 0x10140bb00标准::函数::运算符()(OpaqueJSContext*)常数 rizzle 0x10139a110 facebook::react::tryAndReturnError(std::\uu 1::函数常量&) rizzle 0x1013923a8 facebook::react::RCTMessageThread::tryFunc(std::_1::function const&) CoreFoundation 0x18756016c\uuu CFRUNLOOP\u正在调用\u OUT\u到\u块__ CoreFoundation 0x18755fa3c\uuU CFRunLoopDoBlocks CoreFoundation 0x18755dca4\uuuu CFRunLoopRun CoreFoundation 0x18747e2d8 CFRunLoopRunSpecific rizzle 0x101374c48+[RCTCxxBridge RUNLOOP] 基金会0x187FA7860 libsystem_pthread 0x1871e432c_pthread_主体 libsystem_pthread 0x1871e41f8_pthread_start
3个多月来,我一直在试图弄清这一点,并一直在尝试其他库,但我真的希望能够使用redux persist。

我遇到了完全相同的问题
const store = createStore(
    {
      ... other reducers
      recordsDataA: createReducer('A'),
      recordsDataB: createReducer('B'),
      recordsDataC: createReducer('C'),
      recordsDataD: createReducer('D'),
      recordsDataE: createReducer('E'),
      ...
    },
    applyMiddleware(...middlewares),
    enhancer
)
export const createReducer = key => combineReducers({
  records: recordsReducer(key),
})
const recordsReducer = batch => (state = [], action) => {
  switch (action.type) {

    case REQUEST_RECORDS_SUCCESS:
      return action.records.filter(record => record.id[0].toUpperCase() === batch)

    ... other actions

    default:
      return state
  }
}
export const makeGetAllRecords = () =>
  createSelector(
    [
      state => state.recordsDataA.records,
      state => state.recordsDataB.records,
      state => state.recordsDataC.records,
      state => state.recordsDataD.records,
      state => state.recordsDataE.records,
      state => state.recordsDataF.records,
      ...
    ],
    (...allBatches) => [].concat(...allBatches)
  )
export const getRecordById = (state: Array<Record>, recordId: string) =>
  makeGetAllRecords()(state).find(record => record.id === recordId) || null