AlexDenisov / iActiveRecord

ActiveRecord for iOS without CoreData, only SQLite
http://alexdenisov.github.com/iActiveRecord/
MIT License
354 stars 50 forks source link

Crash on database creation #21

Closed alexiscreuzot closed 12 years ago

alexiscreuzot commented 12 years ago

Hi,

I started implementing this framework in a project and for some reason it seems to crash at the database creation (I think during the tables creation). Then once it has crashed once (and the empty database was created) it work but I have this error : Couldn't retrieve data from database: no such table: Account

Here are my models, nothing really fancy about them.

@interface Account : ActiveRecord

@property (strong, nonatomic) NSNumber * accountId;
@property (strong, nonatomic) NSString * firstName;
@property (strong, nonatomic) NSString * lastName;
@property (strong, nonatomic) NSString * phone;
@property (strong, nonatomic) NSString * gender;
@property (strong, nonatomic) NSDate * birthDate;

has_many_dec(Prescription, prescriptions, ARDependencyDestroy)
@end

@implementation Account

@synthesize accountId;
@synthesize firstName;
@synthesize lastName;
@synthesize phone;
@synthesize gender;
@synthesize birthDate;

has_many_imp(Prescription, prescriptions, ARDependencyDestroy)

@end

@interface Prescription : ActiveRecord

@property (strong, nonatomic) NSNumber * prescriptionId;
@property (strong, nonatomic) NSNumber * accountId;
@property (strong, nonatomic) NSString * picture_name;
@property (strong, nonatomic) NSDate   * date;
@property (strong, nonatomic) NSString * message;
@property (strong, nonatomic) NSDate   * reply_date;
@property (strong, nonatomic) NSString * reply_message;
@property (strong, nonatomic) NSNumber * statusCode;
@property (strong, nonatomic) NSNumber * archived;

belongs_to_dec(Account, account, ARDependencyDestroy)

@end

@implementation Prescription

@synthesize prescriptionId;
@synthesize accountId;
@synthesize date;
@synthesize picture_name;
@synthesize message;
@synthesize reply_date;
@synthesize reply_message;
@synthesize statusCode;
@synthesize archived;

belonsg_to_imp(Account, account, ARDependencyDestroy)

@end 

I could use a hint :/

alexiscreuzot commented 12 years ago

My bad, I used xcode to correct automatically the warnings in the framework, turns out it was not such a good idea. I had change a %s in %@ which made the compiler happy, but not at runtime !