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.
Related
I created a framework writting on pure swift ,
but I cant find any .h file of public class . shouldn't Xcode generate .h file automaticly?
here is project structure
- ProjectName
-- ProjectName.h
-- publicClass.swift
the final projectname.framework does not contails the publicClass.h ,neither any "publicClass" string
Xcode Version 13.1 (13A1030d)
I searched the internet but got little about this problem
Swift doesn't use header files, you only get .swift files. If you want header file you have to use Objective-C.
After practice.
When import your framework in a project, import your framework in
a swift file, long press command then click your framework name in the file, Xcode will create a public interface file automatically, and you will see all your public classes functions.
Below is not a right answer, please ignore it.
Headers png
In TARGETS, select your framework, then in Build Phases, there is a Headers section, you could put your public swift file under Public, then command + B, in your framework folder, headers file, you will see.
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 currently trying to write an App, that connects to a Zebra printer using Swift. I followed these instructions to link the SDK to the project and this page for information on what to add to the bridging header.
This is where it fails. As soon as I add a single line to the bridging header, for example #import "SGD.h" it does not compile, with the error 'SGD.h' file not found
I know this question was already self answered by the writer, but... It doesn't answer the question of how to correctly add the Zebra sdk to a Swift project (which is nowhere to be found on Zebra's site or in the documentation).
Add the framework ".a" file (libZSDK_API.a) to your project.
Add the entire "include" folder provided by Zebra (make sure to add as group)
Add a bridging header
All of that was pretty standard, now here is the tricky part. Add the following imports to the bridging header in this exact same order:
#import "MFiBtPrinterConnection.h"
#import "ZebraPrinterConnection.h"
#import "ZebraPrinter.h"
#import "ZebraPrinterFactory.h"
#import "TcpPrinterConnection.h"
#import "SGD.h"
I figured it out: This was not very clear from the instructions, but I configured those settings in The Project settings, not the Target settings. I also had to disable Bitcode.
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?
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.