What am I doing wrong? It's a very simple statement but couldn't figure out what causes it to fail
FMDatabase *db = [FMDatabase databaseWithPath:appDelegate.databasePath];
[db open];
isSuccess = [db executeUpdate:@"INSERT INTO notes (title, comment, fk) values (?, ?, ?);", title, comment, fkID];
exception.name=NSInvalidArgumentException, exception.reason=-[__NSCFString comment]: unrecognized selector sent to instance 0x68a93f
Note.h
#import <Foundation/Foundation.h>
@interface Note : NSObject
@property (strong, nonatomic) NSString *title;
@property (strong, nonatomic) NSString *comment;
@property (nonatomic) int fkID;
Take a look at FMDB usage.
[db executeUpdate:@"INSERT INTO notes VALUES (?,?,?)", title, comment, [NSNumber numberWithInt:fkID]];
All arguments provided to the -executeUpdate: method (or any of the variants that accept a va_list as a parameter) must be objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With