expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
34.07k stars 5.45k forks source link

Getting "Swift Compile Error" while building for iOS #17722

Closed Saalim95 closed 2 years ago

Saalim95 commented 2 years ago

Summary

I am using expo camera on a bare RN project. Everything works fine in Android but when I run pod install for iOS, I was seeing few errors. They were related with few missing expo packages which I installed later. Finally pod install successfully executed. But when I tried to run app from XCode i am seeing "swift compile error" on ExpoModuleCore swift files.

Screenshot 2022-06-02 at 2 40 33 PM

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

No response

Environment

expo-env-info 1.0.3 environment info: System: OS: macOS 11.5.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.9.1 - ~/.nvm/versions/node/v16.9.1/bin/node Yarn: 1.22.15 - ~/.nvm/versions/node/v16.9.1/bin/yarn npm: 7.21.1 - ~/.nvm/versions/node/v16.9.1/bin/npm Watchman: 2021.10.18.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /opt/homebrew/lib/ruby/gems/3.0.0/bin/pod SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: API Levels: 28, 29, 30, 31 Build Tools: 28.0.3, 29.0.2, 30.0.2, 31.0.0 System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs ARM 64 v8a, android-31 | Google APIs ARM 64 v8a IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 react-navigation: ^4.0.10 => 4.4.4 Expo Workflow: bare

Reproducible demo

{ "name": "AppName", "version": "0.0.1", "private": true, "scripts": { "reset": "watchman watch-del-all && rm -rf node_modules && npm install && npm start --reset-cache && rm -rf /tmp/metro-*", "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint .", "postinstall": "patch-package", "jetify": "jetify" }, "dependencies": { "@bugfender/rn-bugfender": "^1.1.5", "@react-native-community/async-storage": "^1.7.1", "@react-native-community/netinfo": "^5.2.0", "@react-native-firebase/app": "^14.2.2", "@react-native-firebase/crashlytics": "^14.2.2", "@react-native-firebase/perf": "^14.3.0", "@react-native-firebase/storage": "^14.2.2", "@sentry/react-native": "^3.2.3", "@tensorflow/tfjs": "^3.5.0", "@tensorflow/tfjs-react-native": "^0.5.0", "buffer": "^5.4.3", "expo-camera": "^11.0.2", "expo-gl": "^8.0.0", "expo-gl-cpp": "^8.0.0", "jetify": "^1.0.2", "jpeg-js": "^0.4.3", "lodash": "^4.17.15", "patch-package": "^6.2.2", "promise-reflect": "^1.1.0", "pusher-js": "^7.0.6", "react": "16.9.0", "react-native": "0.61.5", "react-native-actionsheet": "^2.4.2", "react-native-background-job": "^2.3.1", "react-native-datepicker": "^1.7.2", "react-native-device-info": "^5.5.8", "react-native-fast-image": "^8.3.4", "react-native-fs": "^2.19.0", "react-native-geolocation-service": "^3.1.0", "react-native-gesture-handler": "^1.5.2", "react-native-gesture-responder": "^0.1.1", "react-native-i18n": "^2.0.15", "react-native-image-pan-zoom": "^2.1.11", "react-native-image-picker": "^2.4.0", "react-native-image-resizer": "^1.1.0", "react-native-image-zoom-viewer": "^2.2.27", "react-native-mixpanel": "^1.2.0", "react-native-onesignal": "^3.6.1", "react-native-orientation-locker": "^1.5.0", "react-native-permissions": "^2.0.8", "react-native-picker-select": "^6.5.1", "react-native-popup-menu": "^0.15.10", "react-native-progress-circle": "^2.1.0", "react-native-queue": "^1.2.1", "react-native-reanimated": "^1.13.4", "react-native-safe-area": "^0.5.1", "react-native-safe-area-context": "^3.4.1", "react-native-screens": "^2.0.0-alpha.22", "react-native-simple-picker": "^3.1.1", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^11.0.1", "react-native-svg-charts": "^5.3.0", "react-native-toast-message": "^2.1.5", "react-native-unimodules": "^0.14.6", "react-native-url-polyfill": "^1.2.0", "react-native-uuid": "^1.4.9", "react-native-vector-icons": "^8.1.0", "react-native-zip-archive": "^5.0.0", "react-navigation": "^4.0.10", "react-navigation-drawer": "^2.7.2", "react-navigation-stack": "^1.10.3", "react-redux": "^7.1.3", "realm": "^3.6.0", "redux": "^4.0.5", "redux-devtools-extension": "^2.13.8", "redux-thunk": "^2.3.0", "socket.io-client": "^2.3.0", "throttle-debounce": "^2.1.0", "ulid": "^2.3.0", "unimodules-camera-interface": "^6.1.0", "unimodules-file-system-interface": "^6.1.0", "unimodules-task-manager-interface": "^7.1.1" }, "devDependencies": { "@babel/core": "^7.17.5", "@babel/runtime": "^7.17.2", "@react-native-community/eslint-config": "^0.0.5", "babel-jest": "^24.9.0", "babel-plugin-transform-remove-console": "^6.9.4", "eslint": "^6.8.0", "jest": "^24.9.0", "jetifier": "^2.0.0", "metro-react-native-babel-preset": "^0.66.2", "react-native-svg-transformer": "^0.14.3", "react-test-renderer": "16.9.0" }, "jest": { "preset": "react-native" } }

gspeicher commented 2 years ago

I am getting the same errors compiling ViewModuleWrapper since upgrading my bare workflow app from Expo SDK 44 to SDK 45.

Not sure if this is of any relevance, but I am not seeing that error on ComponentData in my build.

thiagoferolla commented 2 years ago

Having the same error on react-native 0.64 and expo 45. @Saalim95 did you managed to solve it?

gspeicher commented 2 years ago

For what it's worth, it's working for me now and I'm fairly certain the solution was to completely delete my node_modules folder and then reinstall. From what I could gather, the iOS build process stores generated swift files side by side with the nodejs sources in their module folders, and some of those generated swift files were stale for me.

expo-bot commented 2 years ago

Hi there! It looks like your issue requires a minimal reproducible example, but it is invalid or absent. Please prepare such an example and share it in a new issue.

The best way to get attention to your issue is to provide a clean and easy way for a developer to reproduce the issue on their own machine. Please do not provide your entire project, or a project with more code than is necessary to reproduce the issue.

A side benefit of going through the process of narrowing down the minimal amount of code needed to reproduce the issue is that you may get lucky and discover that the bug is due to a mistake in your application code that you can quickly fix on your own.

Resources