Reputation: 1
I'm working on a macOS SwiftUI app in Xcode and encountering a build failure only when archiving the project. The app builds and runs successfully in Debug and Profiling configurations, but when I try to Archive, it fails with the following errors:
Cannot find type 'AppView' in scope
Cannot find 'Sidebar' in scope
Cannot find 'HomeView' in scope
Cannot find 'MessagesView' in scope
Cannot find 'ChatView' in scope
AppView, Sidebar, HomeView, MessagesView, and ChatView are all in a folder called "Views". They are referenced in the main file, and build successfully when I'm building for debugging or profiling. However, the above errors (Cannot find [HomeView, etc] in scope) only rise when I'm trying to archive the app.
This issue occurs even though: The files exist in the project and are correctly included in Compile Sources under Build Phases. They are checked under Target Membership for the correct target. Defines Module is set to YES for the main app target. The project builds successfully for Debug and Profiling. I have already tried cleaning the build folder, resetting Derived Data, and restarting Xcode.
What I Have Tried:
Question: What else could be causing this error only during Archive? Are there any additional build settings or project configurations that could be interfering? Would really appreciate any guidance!
If this is still not enough information, please let me know what else to add. I've clarified the issue more: an error about scope arises when I'm only trying to archive my app, since it builds successfully in all other modes.
Upvotes: -3
Views: 75