Reputation: 651
I have an iOS app that I've created using Swift. Since I have a widget in my project and I want to share code between my widget and my app, I have a Swift framework also as part of my project. I can successfully build my app. First I have to build the framework, then I can build the app. However, when I try to archive the app for distribution, it fails with two errors.
module.modulemap: Header '{My Framework Name}-Swift.h' not found.
Could not build Objective-C module '{My Framework Name}'.
I have three targets in my app, an app, widget, and framework.
The framework has a collection of Swift files, as well as an Objective-C header with these contents:
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double XScheduleKitVersionNumber;
FOUNDATION_EXPORT const unsigned char XScheduleKitVersionString[];
My Mac is running OS X 10.10.2. Xcode is version 6.3. My app is for iOS 8.0+. The full content of the project I'm working on is open-source and available at https://github.com/Cin316/X-Schedule.
Upvotes: 1
Views: 1260
Reputation: 941
I have run into this frustrating problem before myself. It seems that with pure Swift framework targets the Objective-C header file causes intermittent or strange build errors (Xcode bug?). It seems counter-intuitive but part of the solution at least is to either change the header file from public to project or simply remove it from the build target. I wish I had a better explanation as to why this works!
I have forked your project and created a build (that works on my machine at least) here: https://github.com/acwright/X-Schedule
Hope this helps!
Upvotes: 1