-[PLSqliteDatabase prepareStatement:]: unrecognized selector sent to instance 0x44cca0

11 views
Skip to first unread message

yakbuttercandle

unread,
Sep 9, 2008, 9:05:13 PM9/9/08
to pldatabase
In my iphone app, I am getting the error

-[PLSqliteDatabase prepareStatement:]: unrecognized selector sent to
instance 0x44cca0

I am able to use the database from my test cases but not the app
delegate.

Any idea why?

Landon Fuller

unread,
Sep 9, 2008, 10:14:25 PM9/9/08
to pldat...@googlegroups.com

It's possible that your PLSqliteDatabase instance is being over-
released. How are you creating/retaining your instance?

In the library, the -[PLSqliteDatabase prepareStatement:] method is
only called from the PLSqliteDatabase instance itself.

-landonf

PGP.sig

yakbuttercandle

unread,
Sep 9, 2008, 11:01:10 PM9/9/08
to pldatabase

AppDelegate.h
--------------------
PLSqliteDatabase *db;
@property (nonatomic, retain) PLSqliteDatabase *db;

AppDelegate.m
---------------------

- (void)applicationDidFinishLaunching:(UIApplication *)application {

// open database and init data manager
NSString *pathToDb = [DBUtil pathToDb];
self.db = [[PLSqliteDatabase alloc] initWithPath:pathToDb];
[self.db open];
self.dm = [[DataManager alloc] initWithDatabase:db];


In DataManager through which I do all db access

DataManager.h
---------------------
@private
PLSqliteDatabase *dbase;
}
@property(nonatomic, retain) PLSqliteDatabase *dbase;

- (id)initWithDatabase:(PLSqliteDatabase *)database;

DataManager.m
----------------------
@synthesize dbase;

- (id)initWithDatabase:(PLSqliteDatabase *)database {

if (self = [super init]) {
self.dbase = database;
if (![dbase goodConnection]) {
NSLog(@"Could not connect to database");
return nil;
}

[self initSQLStatementsAndColumns];
}

return self;
}

The database is retained by both AppDelegate and DataManager.
I'm able to establish the connnection to the db. Error occurs on first
prepare statement in DataManager,

Landon - Thanks for looking into this.
>  PGP.sig
> < 1KViewDownload
Reply all
Reply to author
Forward
0 new messages