views:

269

answers:

2

Hi, I'm noob here but, why is it i'm getting this error?

I DO have a table named Team in an SQLite called Team.sqlite! Is there anything else I need to provide?

ERROR
---------------
2009-12-23 23:17:05.277 PitScout[6690:207] *** Assertion failure in -[Team addTeam], /Users/******/Desktop/PitScout/Classes/Team.m:90
2009-12-23 23:17:05.280 PitScout[6690:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error while creating add statement. 'no such table: Team''
2009-12-23 23:17:05.280 PitScout[6690:207] Stack: (
    30131291,
    2502464777,
    30215227,
    810772,
    16329,
    12146,
    20588,
    2753625,
    4667381,
    2753625,
    3160994,
    3169731,
    3164943,
    2858547,
    2766876,
    2793653,
    37420753,
    29916032,
    29912136,
    37414797,
    37414994,
    2797571,
    10780,
    10634
)
+1  A: 
  1. Use CoreData. Using SQLite directly is harder, requires more code, and is a waste of time unless you have very specific needs.

  2. You say:

I DO have a table named Team in an SQLite called Team.sqlite! Is there anything else I need to provide?

This doesn't make sense. Are you saying you have a database named "Team.sqlite"? Or do you have a table named "Team.sqlite"? A table named "Team.sqlite" is not the same as a table named "Team".

How do you create the table? I.e. what is the CREATE TABLE statement you are using?

bbum
Well I decided that Core Data was much more difficult for me, a mere beginner, and I have a FILE named Team.sqlite, and a table named Team in it. !
Galaxas0
There might be a slightly steeper learning curve for Core Data, but give it a chance, especially if your project is for the learning experience. Once you learn how to use Core Data, it will make programming easier. Better to learn how to do it the "right" way from the start then having to learn a new way and unlearn bad habits from the old.
outis
A: 

Note: I restarted my project from scratch and it's fixed now. It turned out to be a problem with my SQL statements. Thanks everyone!

EDIT: The fix was regarding my SQL statements: I was calling for a table that DID exist, but I used:

NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"SQLITE.sqlite"];

instead of:

NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Team.sqlite"];

which was actually caused by one of my earlier builds of the app.

My Teams.m was perfectly fine, however. This was actually within my SQLAppDelegate.m.

Galaxas0
outis