简体   繁体   English

Xcode 11:未更新到应用程序或断点的代码更改不起作用

[英]Xcode 11: Changes in code not updated to app or breakpoint doesn't work

XCode: 11.1 OS: 10.15 Test device: iPhone 5s, iOS: 12.4.2 XCode:11.1 操作系统:10.15 测试设备:iPhone 5s,iOS:12.4.2

Hi guys, I made a stupid mistake to immediately upgrade Xcode and MacOS, without waiting for a later stable version.大家好,我犯了一个愚蠢的错误,立即升级 Xcode 和 MacOS,而不是等待以后的稳定版本。

Anyway, if I made changes in my code, for example adding a NSLog() line, this addition is not updated on the app in my test device.无论如何,如果我对代码进行了更改,例如添加了 NSLog() 行,则此添加不会在我的测试设备中的应用程序上更新。 To make it work, I have to uninstall the app from the test device, and reinstall it by running the code from Xcode.为了让它工作,我必须从测试设备上卸载应用程序,然后通过运行 Xcode 中的代码重新安装它。 This happens every time I make changes in code.每次我对代码进行更改时都会发生这种情况。 I have to delete the app on the device and reinstall it again.我必须删除设备上的应用程序并重新安装。

I was looking for a solution on the internet, but didn't find any.我在互联网上寻找解决方案,但没有找到任何解决方案。 I assume this is a Xcode bug, but I'm also curious if you have the same problem.我假设这是一个 Xcode 错误,但我也很好奇你是否有同样的问题。 If hope someone has a quick fix.如果希望有人能快速解决。

Update 1 On the simulator it works ok.更新 1在模拟器上它工作正常。

Try changing the Build System to Legacy :尝试将Build System更改为Legacy

File > Project Settings > Build System File > Project Settings > Build System

在此处输入图像描述

The new Build System has some problems with app cache.新的构建系统在应用缓存方面存在一些问题。

This happened to me, even changing something simple like a print would cause the breakpoints to stop working.这发生在我身上,即使更改像打印这样简单的东西也会导致断点停止工作。 I would have to reinstall the app on the test device every time I made a change for it to be reflected in the app.每次我进行更改以反映在应用程序中时,我都必须在测试设备上重新安装应用程序。 After I restarted the test phone, Xcode, and cleaned the build folder it worked for me.在我重新启动测试手机 Xcode 后,清理了它为我工作的构建文件夹。

Try to restart the test device, then run the app again.尝试重新启动测试设备,然后再次运行应用程序。 If this does not work:如果这不起作用:

  • Navigate to ~/library/MobileDevice/Provisioning Profiles/导航到 ~/library/MobileDevice/Provisioning Profiles/

  • Remove the.mobileprovision file that corresponds to the app you are working on.删除与您正在使用的应用程序相对应的 .mobileprovision 文件。 (you have to click on the files to see what they are, otherwise its just a long string) (您必须单击文件以查看它们是什么,否则它只是一个长字符串)

  • Navigate to ~/library/Developer/Xcode/DerivedData/YOUR_APP_NAME导航到 ~/library/Developer/Xcode/DerivedData/YOUR_APP_NAME

  • Remove the build folder删除构建文件夹

  • close Xcode, uninstall the app, restart the phone, open the Xcode project, clean the build folder, run the app关闭Xcode,卸载app,重启手机,打开Xcode项目,清理build文件夹,运行app

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

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