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?
Related
GDAL is based on C++ and I created the library by running the scripts provided by the answer here link and also added the modulemap file, targeting the header files as described in the answer, but can't import the module at all.
I also tried to add the bridging header file for linking the header file of the library but, it should be in objective c but in my case it's in C++. I need GDAL for my project to convert the rasters data into coordinates.
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.
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.
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.
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.