Expo EAS iOS构建报错:ExpoModulesCore最低部署目标为iOS13.0
Expo托管工作流iOS构建错误解决方法
问题描述
使用eas build构建Expo托管工作流项目,Android端构建正常,但iOS端出现编译错误:提示当前编译目标为iOS12.0,而ExpoModulesCore的最低部署目标要求为iOS13.0。已在app.json中设置ios.deploymentTarget: "13.0"并安装expo-modules-core,问题仍未解决。
错误信息
❌ (node_modules/react-native-fbsdk-next/ios/ExpoAdapterFBSDKNext/FacebookAppDelegate.swift:1:8) > 1 | import ExpoModulesCore | ^ compiling for iOS 12.0, but module 'ExpoModulesCore' has a minimum deployment target of iOS 13.0: /Users/expo/workingdir/build/ios/build/Build/Products/Debug-iphonesimulator/ExpoModulesCore/ExpoModulesCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule 2 | import FBSDKCoreKit 3 | 4 | public class FacebookAppDelegate: ExpoAppDelegateSubscriber { ❌ (node_modules/react-native-fbsdk-next/ios/ExpoAdapterFBSDKNext/FacebookAppDelegate.swift:1:8) > 1 | import ExpoModulesCore | ^ compiling for iOS 12.0, but module 'ExpoModulesCore' has a minimum deployment target of iOS 13.0: /Users/expo/workingdir/build/ios/build/Build/Products/Debug-iphonesimulator/ExpoModulesCore/ExpoModulesCore.swiftmodule/arm64-apple-ios-simulator.swiftmodule 2 | import FBSDKCoreKit 3 | 4 | public class FacebookAppDelegate: ExpoAppDelegateSubscriber {
相关配置
app.json
"expo": { "name": "eKisállat", "slug": "eKisallat", "version": "1.0.0", "orientation": "portrait", "icon": "./assets/AppIcons/appIcon.png", "splash": { "image": "./assets/AppIcons/SplashScreen.png", "resizeMode": "contain", "backgroundColor": "#519259" }, "updates": { "fallbackToCacheTimeout": 0 }, "assetBundlePatterns": [ "**/*" ], "ios":{ "bundleIdentifier":"", "deploymentTarget": "13.0", "supportsTablet":false, "buildNumber":"1.0.0", }, "android": { "useNextNotificationsApi": true, "googleServicesFile": "./google-services.json", "permissions": [ "RECEIVE_BOOT_COMPLETED", "ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION", "android.permission.INTERNET" ], "adaptiveIcon": { "foregroundImage": "./assets/AppIcons/appIcon.png", "backgroundColor": "#FFFFFF" }, "package": "", "versionCode": 39, "icon": "./assets/AppIcons/appIcon.png", "config": { "googleMobileAdsAppId": "3", "googleMaps": { "apiKey": "g" } } }, "web": { "favicon": "./assets/AppIcons/playstore.png" }, "notification": { "icon": "./assets/AppIcons/playstore.png" }, "plugins": [ "@react-native-google-signin/google-signin", [ "expo-notifications", { "icon": "./assets/AppIcons/playstore.png", "color": "#ffffff" } ], [ "react-native-fbsdk-next", { "appID": "13", "clientToken": "4", "displayName": "eKisállatkönyv" } ], [ "expo-build-properties", { "ios": { "deploymentTarget": "13.0" } } ] ], "extra": { "eas": { "projectId": "8" }, "apiUrl": apiUrl, "apiKey":apiKey, "expoProjectID": expoProjectID, "facebookProdAdd": facebookProdAdd, "firebaseApiKey": firebaseApiKey, "googleWebClientID": googleWebClientID, "androidAdmob":androidAdmob, "androidRewardingAd":androidRewardingAdMob, "iosAdmob": iosAdmob, "iosRewardingAdMob":iosRewardingAdMob, "stripeApiUrl": stripeApiUrl, "stripeKey": stripeKey, "prod": prod, "prodAds": prodAds, "facebookLoginEnabled": facebookLoginEnabled } } }
package.json
{ "name": "", "version": "1.0.0", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", "eject": "expo eject", "eas-build-pre-install": "npm install --save --legacy-peer-deps" }, "dependencies": { "@gorhom/bottom-sheet": "^4", "@react-native-async-storage/async-storage": "1.18.2", "@react-native-community/datetimepicker": "7.2.0", "@react-native-community/netinfo": "9.3.10", "@react-native-google-signin/google-signin": "^8.0.0", "@react-native-picker/picker": "2.4.10", "@react-navigation/native": "^6.0.6", "@react-navigation/native-stack": "^6.9.1", "@react-navigation/stack": "^6.0.11", "@reduxjs/toolkit": "^1.8.5", "@stripe/stripe-react-native": "0.28.0", "axios": "^0.25.0", "dotenv": "^16.0.3", "emoji-dictionary": "^1.0.11", "expo": "^49.0.0", "expo-barcode-scanner": "~12.5.3", "expo-blur": "~12.4.1", "expo-build-properties": "~0.8.3", "expo-camera": "~13.4.2", "expo-clipboard": "~4.3.1", "expo-constants": "~14.4.2", "expo-dev-client": "~2.4.8", "expo-device": "~5.4.0", "expo-document-picker": "~11.5.4", "expo-file-system": "~15.4.3", "expo-font": "~11.4.0", "expo-image-manipulator": "~11.3.0", "expo-image-picker": "~14.3.2", "expo-linear-gradient": "~12.3.0", "expo-location": "~16.1.0", "expo-modules-core": "~1.5.10", "expo-notifications": "~0.20.1", "expo-splash-screen": "~0.20.5", "expo-status-bar": "~1.6.0", "expo-task-manager": "~11.3.0", "expo-updates": "~0.18.12", "firebase": "^9.6.3", "formik": "^2.2.9", "lottie-react-native": "5.1.6", "react": "18.2.0", "react-native": "0.72.4", "react-native-animatable": "^1.3.3", "react-native-animated-pagination-dots": "^0.1.73", "react-native-chart-kit": "^6.12.0", "react-native-dropdown-picker": "^5.3.0", "react-native-fbsdk-next": "^10.1.0", "react-native-gesture-handler": "~2.12.0", "react-native-gifted-chat": "^2.0.1", "react-native-google-mobile-ads": "^12.1.0", "react-native-map-clustering": "^3.4.2", "react-native-maps": "1.7.1", "react-native-masked-text": "^1.12.5", "react-native-qrcode-svg": "^6.1.2", "react-native-reanimated": "~3.3.0", "react-native-safe-area-context": "4.6.3", "react-native-screens": "~3.22.0", "react-native-share": "^8.2.2", "react-native-shared-element": "0.8.4", "react-native-svg": "13.9.0", "react-native-vector-icons": "^9.0.0", "react-native-web": "~0.19.6", "react-navigation-shared-element": "^3.1.3", "react-redux": "^7.2.6", "reanimated-bottom-sheet": "^1.0.0-alpha.22", "yup": "^0.32.11" }, "devDependencies": { "@babel/core": "^7.12.9" }, "private": true }
解决方法
强制react-native-fbsdk-next使用iOS13.0部署目标
修改app.json中的expo-build-properties插件配置,指定仅针对react-native-fbsdk-next同步部署目标:[ "expo-build-properties", { "ios": { "deploymentTarget": "13.0" }, "plugins": ["react-native-fbsdk-next"] } ]或者直接在react-native-fbsdk-next的插件配置中添加专属参数(插件支持该配置时可用):
[ "react-native-fbsdk-next", { "appID": "13", "clientToken": "4", "displayName": "eKisállatkönyv", "iosDeploymentTarget": "13.0" } ]清理构建缓存
- 本地执行
npx expo prebuild --clean清除预构建缓存,再重新运行eas build --platform ios - 远程构建时添加缓存清理参数:
eas build --platform ios --clear-cache,或在EAS控制台手动清除项目构建缓存
- 本地执行
升级react-native-fbsdk-next版本
当前使用的10.1.0版本可能存在部署目标未同步的问题,执行npm install react-native-fbsdk-next@latest升级到最新版本后重新构建手动修改Podfile(预构建场景)
如果执行过expo prebuild,可编辑ios/Podfile,通过以下两种方式设置部署目标:# 方式1:全局设置iOS部署目标 platform :ios, '13.0' # 方式2:仅针对react-native-fbsdk-next单独设置 post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'react-native-fbsdk-next' target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end end修改后提交代码,再执行构建
检查expo-modules-core兼容性
执行npm install expo-modules-core@latest升级到与Expo 49兼容的最新版本,确保模块间版本匹配
内容的提问来源于stack exchange,提问作者AnyamBorogass
相关产品推荐
相关产品推荐

