Xcode构建React Native iOS项目报错:缺失modulemap文件
解决Xcode构建时找不到react-native-geolocation-service模块映射文件的问题
以下是针对性的解决步骤,按顺序尝试:
清理构建缓存
- 在Xcode中按下
Cmd+Shift+K清理Build Folder - 手动删除报错路径对应的DerivedData文件夹:
rm -rf /Users/saan/Library/Developer/Xcode/DerivedData/OneLove-cskgyiozdcaltgbjjotkgypwdqsp - 重启Xcode
- 在Xcode中按下
重新安装依赖与Pod
- 回到项目根目录,删除node_modules:
rm -rf node_modules - 重新安装依赖:
npm install(或yarn install) - 进入ios目录,重新安装Pod:
npx pod-install
- 回到项目根目录,删除node_modules:
检查Podfile配置
打开ios目录下的Podfile,确认包含以下配置:pod 'react-native-geolocation-service', :path => '../node_modules/react-native-geolocation-service'若缺失则添加,之后重新执行
pod install检查Xcode项目配置
- 打开Xcode项目,导航到
Pods->react-native-geolocation-servicetarget - 确认
Build Phases->Headers中,react_native_geolocation_service-umbrella.h被设置为Public - 检查
Build Settings->Module Map File路径是否指向正确位置(一般自动配置,若错误手动修正)
- 打开Xcode项目,导航到
手动创建模块映射文件(极端情况)
如果上述步骤无效,手动在ios/Pods/react-native-geolocation-service目录下创建react_native_geolocation_service.modulemap文件,内容如下:framework module react_native_geolocation_service { umbrella header "react_native_geolocation_service-umbrella.h" export * module * { export * } }保存后重新构建项目
内容的提问来源于stack exchange,提问作者Saankhya Katari
相关产品推荐
相关产品推荐

