英文:
Uploading Expo App to TestFlight Doesn't Load .env File
问题
我正在尝试将我的Expo React Native iPhone应用上传到TestFlight,但我的.env文件没有被加载。我使用eas build
来获取.ipa文件,并使用Transporter将应用加载到App Store Connect。然而,当我在TestFlight中打开构建时,.env变量没有被加载,因此应用程序无法正常使用。我知道使用Xcode是解决此问题的一种方法,但我使用的是VSCode,而且我的应用程序已经非常庞大,现在从Expo回退不太可行。
英文:
I'm trying to upload my Expo React Native iPhone app to TestFlight but my .env files aren't being loaded. I use eas build
to get the .ipa file, and use Transporter to load the app onto App Store Connect. However, when I open the build in TestFlight, the .env variables are not being loaded, so the app is useless. I know that using Xcode is one way to get around this, but I used VSCode, and my app is so large already that going back from Expo now is not really viable.
答案1
得分: 1
当您通过eas build创建新的构建时,您必须将您的环境变量加载到您的Expo项目的secrets中或者加载到eas.json文件中。该文件将如下所示:
{
"cli": {
"version": ">= 2.6.0"
},
"build": {
"preview": {
"distribution": "internal",
"env": {
"MY_API_ROUTE": "www.1234.dev.com"
}
},
"production": {
"env": {
"MY_API_ROUTE": "www.1234.prod.com"
}
}
},
"submit": {
"production": {}
}
}
更多信息,请查阅:https://docs.expo.dev/build-reference/variables/
英文:
when you create a new build via eas build, you have to load your env variables either in your expo projects secrets or into the eas.json file. That file would then look something like
{
"cli": {
"version": ">= 2.6.0"
},
"build": {
"preview": {
"distribution": "internal",
"env": {
"MY_API_ROUTE": "www.1234.dev.com",
}
},
"production": {
"env": {
"MY_API_ROUTE": "www.1234.prod.com",
}
}
},
"submit": {
"production": {}
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论