Xcode在模拟器中正常工作,但不会将代码更改反映到真实设备。

huangapple go评论56阅读模式
英文:

Xcode not reflecting changes in the code to the real device but working properly in simulator

问题

我正在使用Xcode开发React Native应用程序。我在从Xcode运行构建到真实设备时遇到问题,它没有运行我在VSCode中进行的最新更改。但是,在Xcode模拟器中,它能够正确运行并实时显示更改。

起初,我以为可能是因为我的iPhone中有缓存,但当我更改设备时,它仍然运行旧版本。所有我所做的更改都未在真实设备上构建,而模拟器正常运行。

英文:

I am developing a react native app using xcode. I am having problem in running build from xcode to real device where it is not running the latest changes that I make in vscode. But, for xcode simulator it is running properly with realtime changes.

At first I thought maybe it is because cache in my iphone, but when I change the device, it still running the old version. All the changes that I make are not build in real device while the simulator is working fine

答案1

得分: 1

这可能是Xcode未能正确检测到对代码库所做更改的问题。您可以尝试以下几种方法来解决此问题:

  1. 在Xcode中清理项目。转到 "产品" -> "清理构建文件夹",然后尝试重新构建应用程序。
  2. 删除派生数据文件夹。在Xcode中,转到 "首选项" -> "位置",然后单击“派生数据”旁边的箭头。这将带您进入包含Xcode项目的派生数据的文件夹。删除包含应用程序派生数据的文件夹,然后尝试重新构建应用程序。
  3. 重新启动Xcode。有时候Xcode可能会卡住,简单的重新启动可以有所帮助。
  4. 检查您的Xcode构建设置。确保 "仅构建活动架构" 设置为 "否"。否则会导致Xcode为错误的架构构建,从而可能导致在真实设备上运行应用程序时出现问题。
  5. 检查您的Xcode方案设置。确保 "构建配置" 设置为 "调试" 而不是 "发布"。如果设置为 "发布",Xcode可能会使用会导致在真实设备上运行应用程序时出现问题的优化。
  6. 尝试在不同的设备上运行应用程序。如果问题仍然存在,可能存在Xcode项目或代码库的问题。尝试创建一个新项目或检查您的代码库以查找任何问题。
英文:

This could be an issue with Xcode not properly detecting changes made to your codebase. There are a few things you can try to resolve this issue:

  1. Clean the project in Xcode. Go to "Product" -> "Clean Build Folder"
    and try building the app again.
  2. Delete the derived data folder. In Xcode, go to "Preferences" ->
    "Locations"
    and click on the arrow next to "Derived Data". This will
    take you to the folder containing the derived data for your Xcode
    projects. Delete the folder containing the derived data for your app
    and try building the app again.
  3. Restart Xcode. Sometimes Xcode can get stuck and a simple restart
    can help.
  4. Check your Xcode build settings. Make sure that the "Build Active
    Architecture Only"
    setting is set to "No". This can cause Xcode to
    build for the wrong architecture, which can lead to issues with
    running the app on a real device.
  5. Check your Xcode scheme settings. Make sure that the "Build
    Configuration" setting is set to "Debug" and not "Release". If it's
    set to "Release", Xcode may be building the app with optimizations
    that can cause issues with running the app on a real device.
  6. Try running the app on a different device. If the issue persists,
    it's possible that there's an issue with your Xcode project or
    codebase. Try creating a new project or checking your codebase for
    any issues.

huangapple
  • 本文由 发表于 2023年5月10日 15:47:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76216067.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定