Xcode 没有反映来自 react-native 的最新应用程序代码 [英] Xcode not reflecting latest app codes from react-native

查看:22
本文介绍了Xcode 没有反映来自 react-native 的最新应用程序代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,事实证明这不是 AppStore 的问题,我从 Xcode 发布模式运行应用程序,我在模拟器上运行了相同的旧版本,我不知道为什么,但 Xcode 没有运行最新的 jsbundle.

Okay turns out this is not a problem with AppStore i ran the app from Xcode release mode and i got the same old version running on the simulator i don't know why but Xcode is not running the latest jsbundle.

现在我找到了 this 有同样问题的问题并尝试遵循它我运行了这个命令:react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios/assets 并把新生成的main.jsbundle/ios/ProjectName 中,但是当我从 Xcode 运行代码时,它仍然给我一个旧版本我也尝试清理和重建和删除派生数据并再次构建相同的结果

now i found this question with the same problem and tried following it i ran this command: react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios/assets and put the newly generated main.jsbundle inside /ios/ProjectName but still when i ran the code from Xcode it gives me an old version i also tried cleaning and rebuilding and removing derived data and building again with same result

我最近向 Apple App Store 上传了一个应用程序,但似乎有问题这只是应用程序的先前版本,我没有看到应用程序上所做的所有新更改...这对我来说有点奇怪我还在新版本发布中上传了新徽标并且徽标已更新..该版本也在应用商店列表中更新,前一个是 1.0,这个显示 1.1 和Whats new"部分也更新了...我还更改了这个新版本的预览和屏幕截图,这也反映在应用商店列表中,但只有当我下载应用时,我才能获得以前的版本.

i recently uploaded an app to the Apple App Store but seems to be having issues with it here's the case i uploaded the app and it got approved and says its ready for sell but when i go to the app store and download the app it is just the previous version of the app and i don't see all the new changes made on the app...this is kind of strange for me i have also uploaded a new logo on the new version release and the logo is updated..the version is also updated on the app store listing the previous one was 1.0 this one shows 1.1 and the "Whats new" section is also updated...i have also changed the preview and screenshots with this new version that is also reflected on the app store listing but only when i download the app i get the previous version.

我试着去我的应用商店连接然后活动,我看到我的版本有正确的上传日期和版本号......我在这里遗漏了什么吗?

i tried going to my app store connect and then Activity and i see my build is there with a correct uploaded date and build numbers...is there something i am missing here?

谢谢,

推荐答案

这里有一个详细的试错过程,试图确定哪个步骤对解决问题至关重要.

Here is a detailed trial-and-error process trying to pin down which step is crucial to resolve the issue.

我从代码库开始,其中 npx react-native run-ios --configuration Release 确实反映了代码库中的新更改.后续每一轮都在上一轮之后,即前一轮的结束状态可能会影响下一轮.

I start from the code base where npx react-native run-ios --configuration Release does reflect new changes in the code base. Each subsequent round follows the previous round, i.e., the previous round's end state might affect the next round.

  • 从 Xcode 和文件系统中删除 main.jsbundle.
  • 对 React Native 代码库进行更改.
  • 运行 npx react-native run-ios --configuration Release
  • FAIL,新更改未反映在构建中.
  • Remove main.jsbundle from both Xcode and the file system.
  • Make changes to the react native code base.
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.
  • 试试npm start -- --reset-cache
  • 运行 npx react-native run-ios --configuration Release
  • FAIL,新更改未反映在构建中.
  • Try npm start -- --reset-cache
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.
  • 尝试Cmd + Shift + K";在 Xcode 中清理构建.
  • 运行 npx react-native run-ios --configuration Release
  • FAIL,新更改未反映在构建中.
  • Try "Cmd + Shift + K" within Xcode to clean build.
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.
  • 运行 react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/your_app_name/main.jsbundle
  • 运行 npx react-native run-ios --configuration Release
  • FAIL,新更改未反映在构建中.
  • Run react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/your_app_name/main.jsbundle
  • Run npx react-native run-ios --configuration Release
  • FAIL, new changes not reflected in the build.
  • 在 Xcode 中,手动将 main.jsbundle 文件添加到您的应用程序文件夹.在您的项目中,右键单击包含您的应用程序名称的文件夹,选择将文件添加到 your_app_name",然后在应用程序文件夹中添加 main.jsbundle.请注意,我们在此处添加的包是在第 4 轮中创建的.
  • 运行npx react-native run-ios --configuration Release.在命令执行期间的输出消息中,出现一条新消息:Copying/.../your_app_name/ios/your_app_name/main.jsbundle".
  • 成功,新的变化正在显现.这表明在第 4 轮中创建的包用于此构建,而不是缓存在某处的某些先前版本.
  • In Xcode, manually add the main.jsbundle file to your app folder. In your project, right click on the folder baring your app's name, choose "Add file to your_app_name", and add main.jsbundle in the app folder. Note that the bundle we add here was created in Round 4.
  • Run npx react-native run-ios --configuration Release. In the output message during command execution, a new message shows up: "Copying /.../your_app_name/ios/your_app_name/main.jsbundle".
  • SUCCCESS, new changes are showing now. This suggests that the bundle created in Round 4 is used for this build, instead of some previous version cached somewhere.
  • 对 React Native 代码库进行另一次更改.
  • 直接运行 npx react-native run-ios --configuration Release 无需手动构建包.复制消息不显示.
  • FAIL,新更改未反映在构建中.请注意,main.jsbundle 存在于 Xcode 和文件系统中.
  • Make another change in the react native code base.
  • Directly run npx react-native run-ios --configuration Release without building the bundle manually. The copy message does not show up.
  • FAIL, new changes not reflected in the build. Note that main.jsbundle exists in both Xcode and the file system.
  • 运行watchman watch-del-all来清理watchman的缓存.
  • 运行npx react-native run-ios --configuration Release.复制消息不显示.
  • FAIL,新更改未反映在构建中.
  • Run watchman watch-del-all to clean cache of watchman.
  • Run npx react-native run-ios --configuration Release. The copy message does not show up.
  • FAIL, new changes not reflected in the build.
  • 运行 react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/your_app_name/main.jsbundle 以重建一个包.莉>
  • 无需修改Xcode,直接运行npx react-native run-ios --configuration Release.这一次,复制消息出现了.
  • 成功,最新的变化正在显现.
  • Run react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/your_app_name/main.jsbundle to rebuild a bundle.
  • Without tinkering with Xcode, directly run npx react-native run-ios --configuration Release. This time, the copy message shows up.
  • SUCCCESS, the latest changes are showing now.

至少在我的笔记本电脑上,每个新版本都需要手动构建一个离线包,以反映 React Native 代码库的最新变化.构建包仅在将包添加到 Xcode 中的 app 文件夹时才有效.看来我们只需要在Xcode中添加一次bundle即可.

At least on my laptop, manually building an offline bundle is required for each new release build to reflect the latest changes in the react native code base. Building the bundle only works if the bundle is added to the app folder in Xcode. It seems that we only need to add the bundle to Xcode once.

另外一个重要的警告是,不同的 Xcode 版本的行为可能会有所不同.

Also a big caveat is that the behavior might be different with a different Xcode version.

  • macOS Catalino 10.15.6
  • Xcode 11.6
  • 反应原生 0.61.5

这篇关于Xcode 没有反映来自 react-native 的最新应用程序代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆