Header file for included static library not found by swift bridging header during archive - swift

I've run into a very vexing problem.
I've included a 3rd party static library (PDFKitten) into my project, which is a mixture of Swift and Objective-C code. I can build & test just fine in simulator and device.
However, when trying to do an Archive build ready to submit to the app store, the Swift compiler complains that the header PDFKitten/PDFKitten.h cannot be found.
Reproducing this is easy:
Create an empty Swift iOS project in Xcode.
Grab the PDF Kitten project and add it as a sub project.
Add the PDFKitten lib as a dependency
Create an objective-c source file to force the creation of the bridging header. Once the bridging header is created, you can delete the empty objective-c source file again (not the header!)
In the bridging header, add #import
An ordinary build will have no issues.
If you then try to do an archive build you'll get the error message.
Any ideas?

I had the same issue. I was able to get it to archive error-free once I added the path to the "Not Found" header file (in your case, PDFKitten.h) into the Header Search Paths portion of the app's Build Settings.

Related

How to retrieve bridging headers that has been lost

I was trying to put a facebook login in my app. I'm also checking some of the tutorials that'll help me to do this. Then i have created a header file that i also delete since that i wasn't able to accomplished the tutorial that i'm watching. Then all of a sudden, i'm having an error that stating...
Briding Header 'Users/mac/Desktop/App
Files/myApp/myApp-Bridging-Header.h' does not exist
I don't know why is that happening. I try to delete my .swift file and replace it with the same name then it still having an error. I even try to make a .swift file with a different name but still having an error as well.
In build settings.. in “Swift Compiler -Code Generation”—> Objective-C Bridging Header — “reset the Path of Bridging header file”
How to create a Swift Bridging Header Manually
Add a new file to Xcode (File > New > File), then select “Source” and
click “Header File“.
Name your file “YourProjectName-Bridging-Header.h”. Example: In my
app Station, the file is named “Station-Bridging-Header”.
Create the file.
Navigate to your project build settings and find the “Swift Compiler
– Code Generation” section. You may find it faster to type in “Swift
Compiler” into the search box to narrow down the results. Note: If
you don’t have a “Swift Compiler – Code Generation” section, this
means you probably don’t have any Swift classes added to your project
yet. Add a Swift file, then try again.
Next to “Objective-C Bridging Header” you will need to add the
name/path of your header file. If your file resides in your project’s
root folder simply put the name of the header file there. Examples:
“ProjectName/ProjectName-Bridging-Header.h” or simply
“ProjectName-Bridging-Header.h”.
Open up your newly created bridging header and import your
Objective-C classes using #import statements. Any class listed in
this file will be able to be accessed from your swift classes.

Sqlite for custom swift framework

I am creating a custom swift framework for managing all common data of my applications like data base or common classes.
I import the library "libsqlite3.0.tbd" in Linked Frameworks and Libraries, but when I try to put #import "sqlite3.h" in my Umbrella header file, I recite the next error:
Include of non-modular header inside framework module
Any idea?
Thank you very much
Step by Step what I did with my sqlite project for it to work, try this (keep the library added and the #import statement in the header):
First, remove the Header from Build Phases >> Headers.
Then go to Build Settings and add the path to the Header in the Objective-C Bridging Header. If you just created the Framework, didn't change the name of the .h file and your project is called Test, for example, the path will be Teste/Test.h (Xcode 7.1.1).
Hope it works.

Import Objective-c library into Swift App

I'd like to use a statically compiled objective-c library (+ headers) in my Swift app. I've already defined my bridging header for the project but Xcode still can't find the header.
Here's what my project's hiearchy looks
PROJECT_DIRECTORY/
---SwiftApp
------SwiftApp-Bridging-Header.h
------SwiftApp.xcodeproj
------Other Swift files live here
---Objective-C_Dependencies
------SharedLibrary/
---------Public/SharedLibraryInclude.h
---------SharedLibrary.a
The contents of SwiftApp-Bridging-Header.h:
#import "SharedLibrary/SharedLibraryInclude.h"
Despite the SwiftApp's Build Setting's header search paths to include $(SRCROOT)/../Objective-C_Dependencies/SharedLibrary/Public and Swift Compiler - Search Paths's Import Path to also have the same value as above, xcode tells me that
SharedLibrary/SharedLibraryInclude.h can't be found.
What else should I configure for Swift to recognize my external includes?

Unable to connect iOS application in Swift to Objective C files using bridging header

I am trying to connect Parse to my iOS application. I make a bridging header and #import <Parse/Parse.h> in the bridging header. When I try to call any Parse.function inside my AppDelegate.swift, glitchy Xcode8-Beta3 does not autofill or even know Parse is there, despite the bridging header file being right below it! It throws an Unidentified Parse error. I imported all the frameworks Parse instructed to important. Any ideas or should I just avoid Xcode8 completely and go back to coding Android like the rest of the world?
Clean, clean build folder, rebuild and you should be able to use your imported framework.

Static library .a file not updating after perform change in .m files

I have created static library project using the line script files.
Then I am manually copy .h files and .a file and created a framework. using iOS universal framework method.
But it's working fine while creating first time. but changed small modification in .m file its not reflecting in created staic library .a file. but it's working fine while using source files.
Please let me know if you have face similar type of issues.
I think this post answers your question, there is a bug in xcode, according to the signature, the post is by a developer who works on the xcode product. The reply to it shows a solution that has worked for me, which is:
explicitly set the location of the static library to "Relative to Build Products"
with a good text editor, edit the project.pbxproj inside the your project e.g. MyProject.xcodeproj/project.pbxproj and search for a line like the one below containing your library name. Verify that for the path= entry there is no path, and only the filename of your library file. It's nasty to have to do this, but I have found that xcode does not get it right 100% of the time.
{isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMyLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; };
Do a clean build. The working project might be pointing at the old .a file maybe. Cleanup the project and then add the static library.
check and match the .a file creation date/time to ensure that it has been generated after you have made changes to .m file