-3
NSDate *date_of_purchase;

sqlite3_bind_text(addStmt, 5, [date_of_purchase UTF8String], -1, SQLITE_TRANSIENT);

When I run this code, the above error(NSDate may not respond to UTF8String) was coming. Can any one help?

jrturton
  • 118,105
  • 32
  • 252
  • 268

2 Answers2

3

Yes. NSDate doesn't have a method called "UTF8String": http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html

That is a method of NSString. So you might have to create an instance of NSString from your date first, like so: Convert NSDate to NSString

Community
  • 1
  • 1
Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165
0
sqlite3_bind_text(addStmt, 5, **[[date_of_purchase] description] UTF8String]**, -1, SQLITE_TRANSIENT);

UTF8String is method of NSString class.

d.lebedev
  • 2,305
  • 19
  • 27