swift in obj-c project archive problem

I have a current Objective-C Application on the App Store. I recently incorporated a Swift view controller and Swift data model into the project, and I use the following import:

#import "MyApplication-Swift.h"


The project compiles and runs properly in the simulator and also when installed on a test device. However, when I try to archive the project for submission, It fails with a Preprosessor issue: 'MyApplication-Swift.h' file not found.


I checked for the header file and found these:

/Debug-iphoneos/MyApplication.build/DerivedSources/MyApplication-Swift.h

/Debug-iphoneos/MyApplication.build/Objects-normal/arm64/MyApplication-Swift.h

/Debug-iphoneos/MyApplication.build/Objects-normal/armv7/MyApplication-Swift.h


Any ideas why the project builds and runs locally [in the simulator and on a device] but will not archive.

Replies

Have you tried cleaning the build folder before archiving, holding down the option key to get the Product >> "Clean Build Folder..." menu item?


In one of the 6.3 beta versions I ran into problems with a generated header that wasn't updating/creating properly when I switched between different schemes, and maybe you are running into a similar problem?

I had the same issue and changing build setting Precompile Prefix Header to Yes resolved the issue for me. I noticed in a working archive the swift files would be compiled then the prefix header and then the *-Swift.h file would be copied then the .m files. Copying the prefix headers and *-Swift.h file was missing before it went for the m compilation.

Did you pre-compile the main project header or the dependency project ? Did you do the Target setting or the Project ?

@rock hound

I changed it in the main project target build settings.