简体   繁体   English

用于模拟器的自定义 Expo 开发客户端

[英]Custom Expo Development Client for Simulator

I had a specific question about installing a custom expo development client on a simulator, specifically an iOS simulator.我有一个关于在模拟器上安装自定义 expo 开发客户端的具体问题,特别是 iOS 模拟器。 I know that there is a way to install an expo build in a simulator (outlined here: https://docs.expo.dev/build-reference/simulators/ ), but this is just a build and not a development client, which are two very different things.我知道有一种方法可以在模拟器中安装 expo 构建(此处概述: https ://docs.expo.dev/build-reference/simulators/),但这只是构建而不是开发客户端,它是两个非常不同的东西。 The concept of an expo development client is outlined here: https://docs.expo.dev/development/introduction/ .这里概述了 expo 开发客户端的概念: https ://docs.expo.dev/development/introduction/。 That means there is no Fast Refresh available, and I cannot modify my app in real-time by changing my code.这意味着没有可用的快速刷新,并且我无法通过更改我的代码来实时修改我的应用程序。 This is a really important feature for me because I need to make sure my app is compatible with all iPhone sizes, and I need to be able to see the changes quickly without having to make a build every single time.这对我来说是一个非常重要的功能,因为我需要确保我的应用程序与所有 iPhone 尺寸兼容,并且我需要能够快速查看更改,而不必每次都进行构建。 Does anyone know how to do this, or if this is currently even possible?有谁知道如何做到这一点,或者目前是否有可能?

A more detailed explanation of the issue can be found here: https://expo.canny.io/feature-requests/p/custom-dev-clients-for-simulator可以在此处找到对该问题的更详细说明: https ://expo.canny.io/feature-requests/p/custom-dev-clients-for-simulator

Essentially the issue that I had was I did not set up my eas.json file correctly.基本上我遇到的问题是我没有正确设置我的eas.json文件。 I needed to change the preview build profile in the eas.json file so that it contained these parameters: "developmentClient": true and "ios": { "simulator": true } I then built my project using the command eas build --profile preview .我需要更改eas.json文件中的preview构建配置文件,使其包含以下参数: "developmentClient": true"ios": { "simulator": true }然后我使用eas build --profile preview I then followed the steps of downloading the tar.gz file, extracting the .app file, dragging it into the simulator, and I was able to successfully open the app and connect it to Metro where I could then see live changes.然后我按照步骤下载 tar.gz 文件,提取 .app 文件,将其拖入模拟器,我能够成功打开应用程序并将其连接到 Metro,然后我可以看到实时更改。

Like @Raamiz Abbasi said, you can set developmentClient and simulator to true in your eas.json however if you want to go further, you can also use expo-dev-client to create a "custom expo go app" which is basically a customized expo go which you can publish updates to with the eas-update .就像@Raamiz Abbasi 说的那样,您可以在eas.json中将developmentClientsimulator设置为 true 但是如果您想更进一步,您还可以使用expo-dev-client创建一个“自定义 expo go 应用程序”,它基本上是一个定制的expo go,您可以使用eas-update发布更新。

Expo Go and this new "development client" are both clients which serve the purpose of displaying your JS bundles. Expo Go 和这个新的“开发客户端”都是用于显示 JS 包的客户端。 But, with the expo-dev-client you can do cool things like add extra debug buttons into the menu, or run publishes (or eas updates in this case) which would automatically feed into the dev client.但是,使用 expo-dev-client,您可以做一些很酷的事情,比如在菜单中添加额外的调试按钮,或者运行发布(或在这种情况下为 eas 更新),这将自动馈送到开发客户端。

The reasoning for doing this, besides adding extra debug stuff in the debug menu, would be to avoid the pain of only being able to expo publish a "release" build.这样做的原因,除了在调试菜单中添加额外的调试内容外,还可以避免只能expo publish “发布”版本的痛苦。 Right now expo publish builds used with expo go cannot be debuggable.目前,与 expo go 一起使用的expo publish构建无法调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM