Swift Unit Tests PLCrashReporter.h file not found - ios

I'm using (linked) PLCrashReporter.framework in my main swift target, with the following in my bridging header:
#import "PLCrashReporter.h"
#import "PLCrashReport.h"
#import "PLCrashReportTextFormatter.h"
and the following Header Search Paths: $(PROJECT_DIR)/Frameworks/CrashReporter.framework/Headers
It works, but when I try to run my unit tests against the project, I get these two errors:
/Users/me/dev/myapp-ios/MyApp/MyApp-Bridging-Header.h:7:9: 'PLCrashReporter.h' file not found
and
Failed to import bridging header '/Users/me/dev/myapp-ios/MyApp/MyApp-Bridging-Header.h'
How can I help my UnitTests target see this objective-c framework's headers?

Related

Could not build Objective-C module 'mupdfdk'

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:

'FMDB.h' file not found

have been trying to import a header file for database.
I'm getting two errors.
'FMDB.h' file not found
and
ailed to emit precompiled header '/Users/myname/Library/Developer/Xcode/DerivedData/zzzzzz- for bridging header '/Users/myname/Library/Autosave Information/zzzzzz/header.h'
The full path of FMDB.h is the below
/Users/myname/Library/Autosave Information/zzzzzz/fmdb/FMDB.h
In Objective-C Bridging Header : header.h
in the header file, the codes are :
#ifndef Header_h
#define Header_h
#import "FMDB.h"
#endif /* Header_h */
I set Allow Non-modular Includes in Framework Modules as Yes.
It didn't work out for me tho.
Follow a few steps:
Rename your header to --> YourProjectName-Bridging-Header.h
Check/Add Path of this header in your Build Setting --> Under Objective-CBridging Header (You may drag the file path)
Framework Modules as No
Then build, it should work. thanks!
I recently moved to new Mac book with Apple M1 Max chip and got the same error. I resolved it by removing arm64 from EXCLUDED_ARCHS in Build Settings.

error: failed to import bridging header when trying to Archive

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:

Use of undeclared type 'RoboViewController' Swift

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.

Bridging Header Issues

I'm trying to add a Swift file to my app and get a "Failed to import bridging header" error, among others.
Bridging-Header code:
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "Menu.h"
In build settings, try setting "Embedded Content contains Swift Code" to Yes.
Also, it looks like its failing to recognize objects from UIKit, so try adding "import UIKit" atop one of your Swift files.

Resources