Last active
January 25, 2024 03:35
-
-
Save lucasrose/9a224a76fb30125c1550cd81b71b8dad to your computer and use it in GitHub Desktop.
Bug in Expo 50+ in ExpoModulesCore for x86_64-apple-ios-simulator not found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| const path = require("path"); | |
| const configPlugins = require("expo/config-plugins"); | |
| const generateCode = require("@expo/config-plugins/build/utils/generateCode"); | |
| const code = ` | |
| installer.pods_project.targets.each do |target| | |
| target.build_configurations.each do |config| | |
| config.build_settings["ONLY_ACTIVE_ARCH"] = "NO" | |
| end | |
| end | |
| `; | |
| const withReactAppleIosSimulatorNotFoundFix = config => { | |
| return configPlugins.withDangerousMod(config, [ | |
| "ios", | |
| async config => { | |
| const filePath = path.join( | |
| config.modRequest.platformProjectRoot, | |
| "Podfile" | |
| ); | |
| const contents = fs.readFileSync(filePath, "utf-8"); | |
| const addCode = generateCode.mergeContents({ | |
| tag: "withReactAppleIosSimulatorNotFoundFix", | |
| src: contents, | |
| newSrc: code, | |
| anchor: | |
| /\s*installer.target_installation_results.pod_target_installation_results/i, | |
| offset: -2, | |
| comment: "#", | |
| }); | |
| if (!addCode.didMerge) { | |
| console.error( | |
| "ERROR: Cannot add withReactAppleIosSimulatorNotFoundFix to the project's ios/Podfile because it's malformed." | |
| ); | |
| return config; | |
| } | |
| fs.writeFileSync(filePath, addCode.contents); | |
| return config; | |
| }, | |
| ]); | |
| }; | |
| module.exports = withReactAppleIosSimulatorNotFoundFix; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment