I have wrote a wrapper for SQLite3 in Swift and it works fine.
I thought of making a framework of it.
The problem is:
To use SQLite3 in swift, we should import the sqlite3.h using bridging header. But I there is no option for bridging header in framework project.
I have created a .c and .h and imported sqlite3.h in .h and made the .h public header. But it doesn't work. It still gives use of unresolved identifier errors.
How can I import .c and .cpp files into swift framework project?
Thank you!
I think you can only use header files which are there in your project(Anyone correct me if I'm wrong). So, add the sqlite3.h to your project.
Step 1:
Search for sqlit3.h
Xcode.app(right-click)-> show package contents
Step 2:
Search for sqlite.h in your Xcode.app
Step 3:
Drag that file into your xcode project and select copy items if needed
Step 4:
Select the sqlite3.h from navigator and change it to Public in the right-side panel.
Step 5:
Import the sqlite3.h in the header file which Xcode has created for you. You should import it as #import "sqlite3.h"
Step 6:
Now Build the project. It should work fine.
Related
I am following this tutorial for import socket.io to swift. http://socket.io/blog/socket-io-on-ios/
I did everything in the tutorial but I am getting this error:
Use of unresolved identifier 'SocketIOClient'
for this piece of code:
let socket = SocketIOClient(socketURL: "localhost:8900")
My structure:
How can I resolve this problem ?
make sure about 2 things:
select "create groups" not "create folder references"
copy items if needed
In the bridging-header.h change this #import "SocketRocket/SRWebSocket.h" to this:
#import <SocketRocket/SRWebSocket.h>
If it does not work just add:
#import "SRWebSocket.h"
Also rename yout bridging header to Ribony-Bridging-Header.h and add it your project's target settings (refer to your bridging header path not just copy "TicTacIOiOS/Bridging-Header.h" from the documentation for websockets).
Make sure when copying you actually are copying the files. Here's a screen shot showing what I mean.
Don't do this when copying files...
In this image the options "Copy items if needed is deselected"
But be sure to do this
Select the option "Copy items if needed"
Also be sure to build your project after importing into the Bridging Header file. Be sure if it is a framework to import like so
#import <Framework/Framework.h>
But if it is a stand alone .h file then import it like so
#import "MyClass.h"
UPDATE: I would also suggest having a look here to make sure you got the steps right - How to call Objective-C code from Swift
I'm running into a nasty issue trying to import a header from a project that is embedded in my main project. What is the proper way to import RKJSONParserJSONKit.h indicated below?
I'm trying :
#import "RestKit/Support/RKJSONParserJSONKit.h"
but Xcode cannot find that file.
Just do #import "RKJSONParserJSONKit.h", no need to include /ResKit/Support/
you have to import the JSONKit
#import <RestKit/JSONKit.h>
if you have a problem with importing it as above try to load the kit by
#import "RestKit/Code/Support/Parsers/JSON/RKJSONParserJSONKit.h"
but you should add a copy of the RKParser.h into your project
I ended up just copying the required files over from the sample project over to the main project. A very hasty choice, but spending hours debugging header search paths is not my favorite thing to do in Xcode :/
I am using Xcode 4.
I am trying to import the QuartzCore framework into my Xcode project but I get the following compilation error:
/Users/sabobin/Desktop/PlayingCard/PlayingCard/PlayingCardViewController.m:10:26:
error: Quartz/Quartz.h: No such file
or directory
file://localhost/Users/sabobin/Desktop/PlayingCard/PlayingCard/PlayingCardViewController.m:
error: Lexical or Preprocessor Issue:
'Quartz/Quartz.h' file not found
I navigated to the project target, and selected the Build Phases tab, and then added QuartzCore.framework to the Link Binary With Libraries section.
I then used the following import statement in my view controllers implementation file:
#import <Quartz/Quartz.h>
Does anyone have any ideas?
Thanks in advance.
It should have
#import <QuartzCore/QuartzCore.h>
The correct line is #import <QuartzCore/QuartzCore.h>.
It may help you.
#import<QuartzCore/QuartzCore.h>
I am wondering What made you write #import <Quartz/Quartz.h> When the framework you are importing is QuartzCore.
So the correct one as already pointed out by others is #import<QuartzCore/QuartzCore.h>
You no longer need to import QuartzCore as of iOS 7, since it is already included when you "import UIKit".
Should use
#import <QuartzCore/QuartzCore.h>
after importing the QuartzCore.framework from Link Binary With Libraries under Build phase in Xcode.
The instructions for installing the JSON Framework seem to be for older versions of Xcode. I'm relatively unfamiliar with Xcode and I can't figure out how to properly import the framework into my project. I selected all of the files in the "Classes" folder (JSON.h, NSObject+JSON.h, etc.) that comes in the download, dragged them into the main area of my project, and added #import <JSON/JSON.h> to my ViewController's .h and .m files, and I get a No such file or directory error for JSON/JSON.h
What am I doing incorrectly here?
If you’ve placed the files under the Classes group and haven’t taken any further action, they’re at the root of your project directory. As such, import it as
#import "JSON.h"
I think you're indicating that you're importing JSON.h from the JSON folder, and it sounds from your description you don't have those in a folder...
This may be the easiest points out there but it is stumping for some reason. I am trying to include the AssetsLibrary Framework and having issues with getting the compiler to see the actual include file for ALAssetsLibrary when using relative paths.
I am currently using:
#import </Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/AssetsLibrary.framework/Headers/ALAssetsLibrary.h>
And this works but is oh so bad in that it calls out the device and specific OS build. I have added the framework and everything links and runs. I just really do not like using the above absolute path and cannot get any relative paths to work. I have tried many combinations of using quotes ("") and braces (<>). Various relative paths to just System, Library, System/Library...
XCode specifics:
XCode 3.2.5
Component versions
Xcode IDE: 1760.0
Xcode Core: 1763.0
ToolSupport: 1758.0
Found it. Don't know why I did not think of this earlier...
#import <AssetsLibrary/AssetsLibrary.h>
Simple.
In Swift:
Please first of all add the AssetsLibrary framework to your Xcode project: click on the name of your project in the project navigator < Then click on the name of your project under TARGETS < Then click on Build Phases < Then click on Link Binary With Libraries < Then click on the "+ button" and add the AssetsLibrary.framework
Finally add this import below at the top of your swift class:
import AssetsLibrary