umbrella header for module 'myFramework' d

2019-03-11 14:41发布

My Swift / iOS9 framework 'viewer_protocol' uses another and external Objective-C framework (CocoaAsyncSocket). I'm using Carthage to build CocoaAsyncSocket. So far everything works fine: In have an example App inside my framework Xcode Project using my framework without any problems.

Now I want to use my Framework in a different Xcode Project - although using Carthage. I include only my Framework as a dependency and Carthage automatically resolves the dependencies to CocoaAsyncSocket. I embedded both frameworks into this new Xcode Project and build my App: Everything works fine here - except one warning I can't rid off:

/Users/hibento/Repositories/viewer_protocol/<module-includes>:1:1: 
Umbrella header for module 'viewer_protocol' does not include header 'GCDAsyncSocket.h'

This is my framework header:

#import <UIKit/UIKit.h>

//! Project version number for viewer_protocol.
FOUNDATION_EXPORT double viewer_protocolVersionNumber;

//! Project version string for viewer_protocol.
FOUNDATION_EXPORT const unsigned char viewer_protocolVersionString[];

// In this header, you should import all the public headers of your framework     
using statements like #import <viewer_protocol/PublicHeader.h>
#import <CocoaAsyncSocket/CocoaAsyncSocket.h>

As you can see CocoaAsyncSocket.h is imported. Furthermore inside my framework the CocoaAsyncSocket.h file is included:

my framework's folder

What I am missing here? I'm using several others external frameworks inside my framework, there're no warnings for them - all of these external frameworks are written in Swift - CocoaAsyncSocket is pure Objective-C.

This is my frameworks module.modulemap:

 framework module viewer_protocol {
   umbrella header "viewer_protocol.h"

   export *
   module * { export * }
 }

 module viewer_protocol.Swift {
     header "viewer_protocol-Swift.h"
 }

Update

I found a solution: Changing the import statement in my framework header from

#import <CocoaAsyncSocket/CocoaAsyncSocket.h>

to

#import "CocoaAsyncSocket/CocoaAsyncSocket.h"

Now Xcode finds the header file and the warning disappears.

11条回答
可以哭但决不认输i
2楼-- · 2019-03-11 15:01

For me the solution was as follows:

1) Each Objective C framework has 1 header file that contains all the:

#import ...
#import ...
#import ...

2) Make sure that this file imports the missing header.

3) Build the project again, it should remove the warning.

查看更多
forever°为你锁心
3楼-- · 2019-03-11 15:02

Alternatively, you may have exposed files within the Public area of your framework's build phases that should actually be moved back to the Project area.

If you don't want those files to be within your framework's umbrella header so they're publicly accessible, you can revert this.

Goto Framework -> Target -> Build Phases and drag to move the unnecessary header files from Public to Project.

Screenshot

查看更多
The star\"
4楼-- · 2019-03-11 15:03

We got this recently and it was due to corruption in DerivedData. Deleting that folder fixed the problem.

查看更多
Animai°情兽
5楼-- · 2019-03-11 15:06

I had the same issue today

issue was

Umbrella header for module 'HockeySDK' does not include header 'BITHockeyBaseViewController.h'

and the solution was

1.build and run project and go-to Report Navigator

2.look at the warning, click to expand details

it will so you the file name where you need to make change as you can seen in below screen shot

enter image description here

So i just updated my import statement in AppDelegate.m file

New

#import "HockeySDK/HockeySDK.h"

Old

#import <HockeySDK/HockeySDK.h>

and issue gone..

hope this will help someone. who are coming here for solution.

查看更多
Bombasti
6楼-- · 2019-03-11 15:06

For me the fix was rather simple, commit all your changes and build again. The warning disappeared.

查看更多
放荡不羁爱自由
7楼-- · 2019-03-11 15:07

trying to fix a archive build error led me to this error and post

my solution was real simple but took forever for me to figure out.

  • when i ran $ pod install it generated a workspace for me in the same dir as my .xcodeproj file.
  • however i had already created a workspace to use as its parent directory.
  • so then i simply deleted my old workspace and went with the one that pods created

enter image description here


hope this helps someone! glhf!

查看更多
登录 后发表回答