Post

Replies

Boosts

Views

Activity

Xcode 14 live issues broken, shows false errors, but the real errors show only after build and disappear couple of seconds later
Hello, I have several extremely annoying Xcode 14 issues that completely destroyed my productivity. They've been hunting me for the last three or so months. I even searched the darkest corners of the Internet to find the cure, but although I found some solutions for people that had similar problems as mine, they unfortunately didn't help me at all. I have a Swift UIKit project that targets iOS 13.0 and newer (only for iPhone), contains 3 schemas (dev, show and prod channels), uses swift packages with remote and local dependencies. No cocoa pods or something like this. Each schema only defines compilation conditions (so I determine in my code which channel I use), nothing more was affected in the settings. I also use a custom build script that only copies Firebase configuration file to the executable folder depending on project's schema. Even though I tried my best by keeping the project structure as clear as I can do and not changing any other settings, leaving them by default as is, I'm still experiencing frustration, rage and sadness at the same time when I'm working with this project. I encountered the first issue when I was using different Swift Packages depending on project's schema (for dev channel I used an autogenerated dev backend api and so on for show and prod - I wrapped them in #if #else blocks). I also updated Xcode at that time. So the problem was, I got a lot of in-editor error messages saying that Xcode could not find in scope, although the required package was already included in the file. And here comes the frustration - the project still successfully builds. I tried to solve this problem by merging these three packages into one and import them without #if #else tricks, but that didn't help. To make things even worse, autocompletion and code suggestion were broken for all imported Swift Packages - it doesn't matter if package was remote or local. I tried to clean, rebuild, close Xcode, remove DerivedData folder, open Xcode in every combination I can imagine, but that didn't work, the problem didn't go away. After a couple of updates I also realized that live issues were completely broken. I didn't get any warnings and errors while coding. Only after building the project, real warnings and errors appeared in the editor and issue navigator, but only for three-four seconds, and then disappeared again. That drove me crazy. Tried to solve this problem with the same methods, it didn't help. Only after disabling live issues, the real warnings and errors did not disappear, but code suggestion and completion were still not working. I enabled Xcode indexing log by typing defaults write com.apple.dt.Xcode IDEIndexShowLog -bool YES in the Terminal app. I found out that Xcode was not able to find one module: /somePath/SomeFile.swift 0.2 seconds no such module 'somePackageName' This error appeared for every file I open and every character I type, but the error was pointing only at that specific file that actually imports that module. So I import this module (also added in the project settings), but still get an error that the module was not found, but again the project successfully compiles and runs. It is an Xcode Framework from a third-party developer that they provided for us. The framework contains binaries only for ios-arm64 and ios-arm64_x86_64-simulator. I use a glorious M1 Mac. I decided yesterday to create a new project and copy there all code and resource files. I thought that I accidentally broke something in the settings and so I made them again from scratch. I did not had my Lightning cable this time, so I built the app for iPhone 14 Pro simulator. And the Xcode heard my prayers - everything was working great. The live issues worked as they should, I did not get any false errors and the autocompletion and code suggestions were fine. I got relief on that cloudy evening... But that's too good to be true, here is the plot twist. I got today my Lightning cable back, connected an iPhone to my Mac. And now I got all these issues again 💀 So now it looks like these issues only happen when I select a physical device as a run destination. I discovered it while writing this post. Any suggestions how to solve this?
4
10
4.8k
Apr ’23