umbrella header for module 'myFramework' does not include header 'otherFramework.h'
Asked Answered
E

14

65

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/John/Repositories/my_project/<module-includes>:1:1: 
Umbrella header for module 'my_project' does not include header 'GCDAsyncSocket.h'

This is my framework header:

#import <UIKit/UIKit.h>

//! Project version number for my_project.
FOUNDATION_EXPORT double my_projectVersionNumber;

//! Project version string for my_project.
FOUNDATION_EXPORT const unsigned char my_projectVersionString[];

// In this header, you should import all the public headers of your framework     
using statements like #import <my_project/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 my_project {
   umbrella header "my_project.h"

   export *
   module * { export * }
 }

 module viewer_protocol.Swift {
     header "my_project-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.

Exsanguine answered 3/10, 2015 at 14:6 Comment(0)
B
48

I recently ran into same issue. Apparently I had header file set as public in target membership, but it was not exposed in umbrella header. Fixed issue by making header file with project access instead of public.

Baggs answered 3/8, 2016 at 9:49 Comment(3)
This should have way more upvotes. Fixing the header's privacy setting is a far better solution than importing something you don't need.Dermott
This worked for me as well. I could not actually make mine public as suggested above, because it included C++ stuff that Swift could not handle. :Fawcette
I feel like this is the answer they were getting at when they wrote the error message. Thanks for putting it into actionable words!Valine
H
30

I had the same issue. Seemed to be related to old build files.

The standard Xcode problem fixer worked for me:

  1. Clean project (Product > Clean Build Folder)
  2. Deleted derived data
  3. Restart Xcode
Himelman answered 21/8, 2016 at 23:58 Comment(4)
On XCode 8 I had the same issue and only this worked. Cleaning not, needed to delete the derived data.Melanesian
I cleaned the build folder(option+cmd+shift+K) and builded again. Warning disappeared.Photofinishing
How do you delete the derived data?Strategy
@Strategy Very late answer to your question: Derived Data can be found in ~/Library/Developer/Xcode/DerivedData. Within that, there is a derived data folder for each project you’ve loaded into Xcode on that computer. You generally don’t need to delete the whole DerivedData folder, just the one for the specific project you’re working on. And usually you’ll want to see if Product -> Clean Build Folder… first.Insanity
T
27

I had the same issue today

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.

Tangier answered 10/3, 2016 at 8:47 Comment(2)
The same for me but in my case the problem was Twitter.SDK. Thanks for you response!Conspecific
i had the same issue with UnityAds SDK. i was doing #import "UnityAds/UnityAds.h" instead of #import <UnityAds/UnityAds.h>Genus
T
16

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.

Tribunal answered 23/3, 2016 at 8:40 Comment(1)
Thank you for this.Ioyal
G
14

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

Garvin answered 29/8, 2017 at 22:15 Comment(2)
awsome. u save meSophisticated
Hi could you please check my question: #56769804Adachi
C
7

Just for completeness if your header is set to public in :

Build Phases > Headers

You should either

Include the import in your main header as others have mentioned

OR

Move that header to "private" if it doesn't need to be exposed

Crofoot answered 15/7, 2016 at 14:47 Comment(0)
T
6

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

Tallyho answered 23/8, 2017 at 22:38 Comment(0)
F
1

For others : In my case I already move the headers I want to expose from my framework, from "project" to "public" (Build phases of the framework target)

Then Xcode gave my this warning.

Xcode is telling us that we also need to add #import "name of header in the warning> in the public header file that was created with framework, so the clients (of the framework) will know this header.

So The Fix:
1.go to the framework public header file.(the one what created by xcode when you created the framework) .
2. add #import "the-name-of-the-header-in-the-warning.h"

Foveola answered 16/10, 2018 at 12:51 Comment(1)
This is the best, simplest distillation of the solution. Thanks!Valine
F
1

In my case (Obj-c framework):

Umbrella header for module 'opus' does not include header 'opus_multistream.h'

I needed to change:

@import opus.opus_defines;

into

@import opus;

(I don't have in #import "....h" or #import <....h> for frameworks)

Fbi answered 29/7, 2019 at 6:39 Comment(0)
S
1

Deleting DerivedData did the trick for me. Try running the below command and see if it works.

rm -rf ~/Library/Developer/Xcode/DerivedData
Saturate answered 12/9, 2022 at 18:40 Comment(0)
I
0

Take a look at this post:

@import vs #import - iOS 7

It goes over the concepts of the new module importing. I had my own custom framework and after adopting the new method to import objective-c framework

old: #import <MyFramework/MyFramework.h>

new: @import MyFramework;

it took care of the warning/

Inguinal answered 4/12, 2017 at 22:46 Comment(0)
I
0

An error like this was driving me crazy for a while this afternoon.

It turned out that my umbrella header - the global one with all the imports of public headers in it - had somehow got set to be Private. This caused the module verifier to complain about all the headers included by it - which were actually fine - rather than about the global header itself.

Switching it back to Public fixed the problem.

Inset answered 13/10, 2023 at 0:25 Comment(0)
A
-1

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!

Agronomy answered 29/8, 2016 at 7:36 Comment(0)
J
-1

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

Jandy answered 25/1, 2017 at 8:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.