I'm trying to add mupdf framework to a swift project. I created a new project and copied the mupdfdk.framework to my project and referenced it in the frameworks section. Following is a screenshot of the documentation.
Now my project looks like this.
Then when I try to import it in viewcontroller, I get Could not build Objective-C module 'mupdfdk' error. Are there any other steps I'm missing? Please help.
You need to add this bridging header:
MuPDF-Bridging-Header.h
#ifndef MuPDF_Bridging_Header_h
#define MuPDF_Bridging_Header_h
#import "mupdfdk.framework/Headers/mupdfdk.h"
#endif /* MuPDF_Bridging_Header_h */
and declare it within the Swift Compiler section of the Build Settings:
I have created two targets of my application i.e Dev and Prod. How can I add bridging header to it for both the version? Is one bridging header is works for both or I have to create two for different targets?
You can add bridging these steps.
Select Target -> Build Settings -> Objective-C Bridging Header -> fill the specified field.
Please follow the steps below to add Swift Bridging Header in your project,
Add a new file to Xcode (File > New > File), and select Source and choose Header File
Create your file ProjectName-Bridging-Header.h
In Build Settings, Next to Objective-C Bridging Header you need to add the path of your header file. i.e ProjectName/ProjectName-Bridging-Header.h or ProjectName-Bridging-Header.h.
Import your Objective-C classes using #import <Class Name>
In Swift you can use the "#if/#else/#endif" in Bridging Header file.
#if DEBUG
#import "devVersion.h"
#else
#import "prodVersion.h"
#endif
"Now, you must set the "DEBUG" symbol elsewhere, though. Set it in the "Swift Compiler - Custom Flags" section, "Other Swift Flags" line. You add the DEBUG symbol with the -D DEBUG entry.
As usual, you can set a different value when in Debug or when in Release."
Ref: https://stackoverflow.com/a/24152730/3089616
Hope this help!
I'm trying to Archive my project but I can't because this error:
/Users/username/Developer/clickbalance/cb-ventas/CB Ventas/CB Ventas/Header.h:12:9: error: 'StarIO_Extension/StarIoExt.h' file not found
#import <StarIO_Extension/StarIoExt.h>
^
<unknown>:0: error: failed to import bridging header '/Users/username/Developer/clickbalance/cb-ventas/CB Ventas/CB Ventas/Header.h'
** ARCHIVE FAILED **
I tried everything like the other questions says about a similiar error like this question: Getting "file not found" in Bridging Header when importing Objective-C frameworks into Swift project
But nothing work.
Here is the location of the framework and the header file:
I linked the .frameworks files in the Link Binary With Libraries too.
This is my header file:
#import <Foundation/Foundation.h>
#ifndef StarIO_Extension_Bridging_Header_h
#define StarIO_Extension_Bridging_Header_h
#import <StarIO_Extension/StarIoExt.h>
#import <StarIO_Extension/StarIoExtManager.h>
#endif /* StarIO_Extension_Bridging_Header_h */
The Objective-C Bridging Header I set to ${PROJECT_DIR}/CB Ventas/Header.h and is set at the Target level, and NOT the Project level
I'm using Cocoapods too.
How can I solve that problem to archive the project?
Make sure you have the framework checkbox checked for the target you are trying to archive in the Utilities pane -> Target Membership:
I install RoboReaderPDF framework via pod in my project and I imported it in my Bridging-Header.h file
the issue is when I am trying to instantiate the RoboViewController I am getting this error
Use of undeclared type 'RoboViewController'
any help!?
Looks like your bridging header has not been set up correctly. It should have the following structure.
#ifndef Bridging_Header_h
#define Bridging_Header_h
#import <RoboReaderPDF/RoboReader.h>
#endif
Importing the RoboReader.h file will also import the view controller (check file contents).
Additionally, also check that your bridging header has been specified under Objective-C Bridging Header key in Swift Compiler - Code Generation segment in Build settings.
I'm using Xcode6 GM to create a Coacoa Touch Framework (a new function in Xcode6), then this framework is included into my app.
Everything is fine (works fine), except that I get warnings in "#import". What is the root cause?
I ran into the same problem and eventually fixed it by adding my project headers into the umbrella header. When you create a new framework it should start with a single .h file titled by the project (in your case DirectProximityFramework.h).
Inside this file is a comment:
In this header, you should import all the public headers of your
framework using statements like #import <DirectProximityFramework/PublicHeader.h>
So just add your GeofencingHelper.h file in this file:
#import <DirectProximityFramework/GeofencingHelper.h>
This should remove all of your warnings!
Maybe, you can stop this warning by adding following line to "DirectProximityFramework.h"
#import <DirectProximityFramework/GeofencingHelper.h>
...etc
I suggest to check
[Target your framework] -> Build Phases -> Headers -> Public
In case if it is not your framework and there is nothing to do you can disable warning in such way
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincomplete-umbrella"
#import <DirectProximityFramework/GeofencingHelper.h>
#pragma clang diagnostic pop
Note - it is not a fix, it just hide the problem.
I ran into this issue and all the solutions above didn't fit me, since the file wasn't supposed to be in the umbrella header.
So if this is your own framework and that particular file shouldn't be in the umbrella header, make sure it isn't marked public in the target membership section.
That fixed it for me.
I had same issue and my solution was..
When you create the framework project.Your project automatically "yourProjectName.h" file gets created, In this header file import class class.
In my case I am getting missing submodule 'MSFramework.MSLocationManager' [-Wincomplete-umbrella]this warning.
resolved by Just importing
#import <UIKit/UIKit.h>
# import "MSLocationManager.h"
//! Project version number for MSFramework.
FOUNDATION_EXPORT double MSFrameworkVersionNumber;
//! Project version string for MSFramework.
FOUNDATION_EXPORT const unsigned char MSFrameworkVersionString[];
here I just add the # import "MSLocationManager.h"in header file.
// In this header, you should import all the public headers of your framework using statements like
#import <GameworkSDK/GWObject.h>
like this:
#import <UIKit/UIKit.h>
#import <GameworkSDK/GWObject.h>
//! Project version number for GameworkSDK.
FOUNDATION_EXPORT double GameworkSDKVersionNumber;
//! Project version string for GameworkSDK.
FOUNDATION_EXPORT const unsigned char GameworkSDKVersionString[];
i had this problem cocoa pods
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
glhf!
Set header search path in your project setting:
TARGETS / Build Settings / Header Search Paths
"$PODS_CONFIGURATION_BUILD_DIR/[YOUR PROJ NAME]/[YOUR PROJ NAME].framework/Headers"
Now import the header file.
#import <DirectProximityFramework.h>