Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift Compiler Error: use of undeclared type with framework

I'm importing a newer version of a custom framework LCCommLibrary that creates the LCConnection class and I'm absolutely perplexed why this will build but not archive after trying multiple things.

  • Making sure the targets are added (4 apps, 1 Test)
  • Cleaning and Restarting the Project

This does builds and runs to my iOS devices, but none of the targets will Archive.

Build Phases

Compiler Error

like image 285
Macness Avatar asked Oct 18 '18 04:10

Macness


2 Answers

Archive usually uses the Release build configuration while building/running on the device uses the Debug build configuration, this is the hint that you have an issue there.

I would say in your case you can to go into the target's build settings, then look at Other Linker Flags, Runpath Search Paths and Library Search Paths, expand them to show the Debug and Release configurations and then ensure you have the same settings for both of them, you'll most probably find something missing in release in one of those.

like image 141
Mostafa Berg Avatar answered Nov 14 '22 09:11

Mostafa Berg


Finally found the issue. The culprit was framework that was included was a debug version of the framework. This causes Archive Schemes to throw this error since the archive uses the Release as the default.

The resolution was to open the LCCommLibrary Project separately, change the Framework Target's Run Scheme to Release, Run and Build, Locate the target framework, import and embed that back into main project file, and archive as usual.

like image 2
Macness Avatar answered Nov 14 '22 09:11

Macness