我有一个使用Expo构建的React Native项目,我们刚刚将其从SDK 35更新为SDK 36,但是现在它无法在Android和iOS上启动。在iOS上,它实际上会使Expo应用程序崩溃,而在Android上,它只是坐在白屏上。我假设这是其中一个依赖项的问题,但是我通常不是React Native开发人员,所以我不确定它可能是哪一个,但是可能基于以下异常而使用NetInfo?
以下是来自iOS模拟器的一些日志。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber
isEqualToString:]: unrecognized selector sent to instance 0x86ab4ddf6b4312df'***
First throw call stack:
(
0 CoreFoundation 0x00007fff23c4f02e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50b97b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c6ff94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c53dac ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23c55f38 _CF_forwarding_prep_0 + 120
5 Exponent 0x00000001020ed764 -[ABI37_0_0RNCNetInfo detailsFromInterface:withState:] + 97
6 Exponent 0x00000001020ed51c -[ABI37_0_0RNCNetInfo currentDictionaryFromUpdateState:withInterface:] + 147
7 Exponent 0x00000001020ed44c -[ABI37_0_0RNCNetInfo getCurre<…>
日志2
2020-09-07 08:38:42.448 [info][tid:com.facebook.ABI37_0_0React.JavaScript] │ '<decode: mismatch for [%c] got [STRING public sz:639]> next state', 'color: #4CAF50; font-weight: bold', { offline:
{ busy: false,
lastTransaction: 0,
online: false,
outbox: [],
retryCount: 0,
retryScheduled: false,
netInfo: { isConnectionExpensive: null, reach: 'NONE' } },
newCatchRecord: {},
signIn: { authToken: undefined, isSignedIn: false, userId: undefined, refreshToken: undefined, numRefreshRetries: 0 },
preferences: { vessels: [], gears: {}, ports: {},species: {} },
submissions: {},
_persist: { version: -1, rehydrated: false } }
以及package.json
"dependencies": {
"@expo/vector-icons": "^10.0.0",
"@redux-offline/redux-offline": "^2.6.0-expo.0",
"axios": "^0.18.0",
"bson": "^4.0.2",
"expo": "^36.0.0",
"expo-font": "~8.0.0",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"promise.prototype.finally": "^3.1.0",
"react": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
"react-native-appearance": "~0.3.1",
"react-native-gesture-handler": "~1.5.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-simple-radio-button": "^2.7.3",
"react-native-status-bar-height": "^2.3.1",
"react-navigation": "^3.11.0",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0",
"redux-persist-transform-encrypt": "^2.0.1",
"redux-thunk": "^2.3.0",
"styled-components": "^4.1.3",
"@react-native-community/netinfo": "4.6.0"
}
答案 0 :(得分:0)
这是由于netinfo 4.x.x
升级到netinfo 5.x.x
(特别是5.9.7)中的问题而解决的。