Expo开发iOS端加载失败求助:Invariant Violation错误排查
问题:iOS端Expo投屏无法加载应用,报原生模块不存在及组件未注册错误
我正在开发一个React Native项目,Android设备能正常加载,之前iOS也能运行,但近一周iOS端完全打不开。因为没有MacBook,我用Expo投屏到手机查看进度。
报错信息
iOS Bundling complete 1772ms
ERROR Invariant Violation: Your JavaScript code tried to access a native module that doesn't exist.
提示若使用Expo Go不支持的模块,需创建应用开发构建
ERROR Invariant Violation: "main" has not been registered. 可能原因:
- Metro(本地开发服务器)运行目录错误,需检查Metro状态,停止后在当前项目重启
- 模块加载失败导致未调用AppRegistry.registerComponent
相关代码片段
index.js
/** * @format */ import {AppRegistry} from 'react-native'; import App from './App'; import {name as appName} from './app.json'; AppRegistry.registerComponent(appName, () => App);
app.json
"expo": { "name": "Mapp", "slug": "Mapp", "version": "1.0.0", "orientation": "portrait", "icon": "./assets/MaAssets/images/Ma.png", "userInterfaceStyle": "light", "splash": { "image": "./assets/MaAssets/images/Ma.png", "resizeMode": "contain", "backgroundColor": "#000000", "animated": true }, "updates": { "fallbackToCacheTimeout": 0 }, "assetBundlePatterns": [ "**/*" ], "ios": { "supportsTablet": true
AppDelegate.m
NSDictionary *initProps = [self prepareInitialProps]; UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"Mapp", initProps);
内容的提问来源于stack exchange,提问作者noobcoder
相关产品推荐
相关产品推荐

