Reputation: 97
I am currently working to link an sqlite3 db to my ios project. I have created the project as a single view application. ![enter image description here][1] as you can see in the image below I have my set frameworks and my database file. However when I type in the #import "./usr/include/sqlite3.h" it says that the file is not found.
What I'm trying to do is create a database that holds roughly about 100 items. Personally I did not want to use CoreData and this was the simplest way of setting up the db. If anyone has a suggestion on how to set this dd it would be greatly appreciated.
#import <UIKit/UIKit.h>
***#import "/usr/include/sqlite3.h"***
@interface databaseViewController :UIViewController {
UITextField *name;
UITextField *address;
UITextField *phone;
UILabel *status;
NSString *databasePath;
sqlite3 *contactDB;
}
@property (retain, nonatomic) IBOutlet UITextField *name;
@property (retain, nonatomic) IBOutlet UITextField *address;
@property (retain, nonatomic) IBOutlet UITextField *phone;
@property (retain, nonatomic) IBOutlet UILabel *status;
- (IBAction) saveData;
- (IBAction) findContact;
@end
Upvotes: 2
Views: 3344
Reputation: 123
add libsqlite3.tbd on your project
select your TARGETS > Build Phases > Link Binary With Libraries
add libsqlite3.tbd
I've got xcode7
Upvotes: 0
Reputation: 19
To get best tutorial for iphone Sqlite Database connectivity you can click HERE:
And add libsqlite3.dylib to your project. Then add #import "sqlite3.h" in .h file of your class in which you have to use sqlite.. For more detail you can revert me..
Upvotes: 2
Reputation: 1102
Actually, the code
#import "/usr/include/sqlite3.h"
should also work, but anyway it is incorrect to use this approach. The correct way is to include like this:
#import <sqlite3.h>
So Xcode will always search for the header in the appropriate SDK currently used to build project. And don't forget to add libsqlite3 to a linked libraries section of your target.
Upvotes: 6