error: failed to import bridging header when trying to Archive - ios

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:

Related

'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.

When trying to add my helper class in bridging header file getting error

I Have swift project which contains some objc helper classes so i've added a bridging header file LiveWallpapers-Bridging-Header.h i am trying add IAPHelper which contains RMStore.h file but after adding the IAPHelper into Bridging header file getting error like this
fatal error: file '/Users/iosdev/Desktop/LiveWallpapers/LiveWallpapers/LiveWallpapers-Bridging-Header.h' has been modified since the precompiled header '/Users/iosdev/Library/Developer/Xcode/DerivedData/LiveWallpapers-fwqqyradpdlkpffqjjjyrrtjxglv/Build/Intermediates.noindex/PrecompiledHeaders/LiveWallpapers-Bridging-Header-swift_2PVFNGTY415W9-clang_GDHQ1O60MXTQ.pch' was built
note: please rebuild precompiled header '/Users/iosdev/Library/Developer/Xcode/DerivedData/LiveWallpapers-fwqqyradpdlkpffqjjjyrrtjxglv/Build/Intermediates.noindex/PrecompiledHeaders/LiveWallpapers-Bridging-Header-swift_2PVFNGTY415W9-clang_GDHQ1O60MXTQ.pch'
/Users/iosdev/Desktop/LiveWallpapers/LiveWallpapers/LiveWallpapers-Bridging-Header.h:10:9: note: in file included from /Users/iosdev/Desktop/LiveWallpapers/LiveWallpapers/LiveWallpapers-Bridging-Header.h:10:
#import "IAPHelper.h"
^
/Users/iosdev/Desktop/LiveWallpapers/LiveWallpapers/Objc/IAPHelper.h:11:9: error: 'RMStore.h' file not found
#import "RMStore.h"
^
1 error generated.
<unknown>:0: error: failed to emit precompiled header '/Users/iosdev/Library/Developer/Xcode/DerivedData/LiveWallpapers-fwqqyradpdlkpffqjjjyrrtjxglv/Build/Intermediates.noindex/PrecompiledHeaders/LiveWallpapers-Bridging-Header-swift_2PVFNGTY415W9-clang_GDHQ1O60MXTQ.pch' for bridging header '/Users/iosdev/Desktop/LiveWallpapers/LiveWallpapers/LiveWallpapers-Bridging-Header.h'
I tried to add RMStore.h in bridging Header file then getting error as below
/Users/iosdev/Desktop/LiveWallpapers/LiveWallpapers/LiveWallpapers-Bridging-Header.h:10:9: error: 'RMStore.h' file not found
#import "RMStore.h"
^
1 error generated.
<unknown>:0: error: failed to emit precompiled header '/Users/iosdev/Library/Developer/Xcode/DerivedData/LiveWallpapers-fwqqyradpdlkpffqjjjyrrtjxglv/Build/Intermediates.noindex/PrecompiledHeaders/LiveWallpapers-Bridging-Header-swift_2PVFNGTY415W9-clang_GDHQ1O60MXTQ.pch' for bridging header '/Users/iosdev/Desktop/LiveWallpapers/LiveWallpapers/LiveWallpapers-Bridging-Header.h'
Any suggestions ?
check your 'RMStore.h' file on your project, if its textcolor is red it was deleted from your project, copy your file on project folder then drag and drop on your project.
clean and build

Swift Unit Tests PLCrashReporter.h file not found

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?

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.

Using an Obj-C sub-project in a Swift application

My team has a few full Obj-C libraries we like te reuse in our projects. To do so, we usually set up a git submodule, and then add it to the xcode project as a sub-project (Using target dependency, link binary with library and updating the User Header Search Paths)
So far it's only been done in full Obj-C projects, and I'm now trying to use it in a Swift project but with very little success so far. I tried to add the briding-header file, referenced it in the project and filled it like so :
#import "MyLibraryHeader.h"
With the target header being in the User Header Search Paths.
It lets me build, but when using it in my Swift files:
let test = MyLib();
let secondTest = MyLib.classMethod1("some_arguments");
I get an EXC_BAD_INSTRUCTION on secondTest, and the following logs in the debugger:
(lldb) po test
error: <EXPR>:1:1: error: use of unresolved identifier 'test'
(lldb) po secondTest
error: Error in auto-import:
failed to get module 'MyProject' from AST context:
/Users/siegele/Sources/MyProject_iOS/MyProject/Classes/MyProject-Bridging-Header.h:12:9: error: 'MyLibraryHeader.h' file not found
#import "MyLibraryHeader.h"
^
failed to import bridging header '/Users/siegele/Sources/MyProject_iOS/MyProject/Classes/MyProject-Bridging-Header.h'
Found the following question with no answer : Xcode 6 crashing when using Objective-C subproject inside Swift
Any help would be appreciated.
I followed the HockeyApp tutorial that can be found here:
http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/integrate-hockeyapp-for-ios-as-a-subproject
In the end, I was on the right tracks but messed up the Header Search Paths:
Add subproject xcodeproj to the workspace
On the main project : Link binary with library, and add the subproject product library (Bonus points : add it as a target dependency too)
Update Header Search Paths (not User Header Search Paths) accordingly
Import your Library.h in the main project Bridging-Header.h file
What threw me off for a while is that the Swift Compiler setting for the Objective-C Bridging Header was not set automatically. Check the Build Settings for your target and ensure the "Objective-C Bridging Header" setting is not blank.

Resources