0
DBAccessクラスのオブジェクトにデータを渡しているときにNSInvalidArgumentExceptionが発生しました。NSInvalidArgumentExceptionの問題
ObjectClass-> ItemShow
@interface ItemShow : NSObject
{
NSString *itemYear;
NSInteger KMRef;
NSString *mintMark;
NSInteger rarity;
NSString *specialRemark;
NSString *mintage;
NSString *dateCode;
NSString *dateDescription;
NSString *dateComment;
NSString *masterMark;
NSInteger availability;
NSInteger quality;
}
@property(nonatomic,retain)NSString *itemYear;
@property(nonatomic)NSInteger KMRef;
@property(nonatomic)NSInteger rarity;
@property(nonatomic)NSInteger availability;
@property(nonatomic)NSInteger quality;
@property(nonatomic,retain)NSString *specialRemark;
@property(nonatomic,retain)NSString *dateComment;
@property(nonatomic,retain)NSString *mintage;
@property(nonatomic,retain)NSString *mintMark;
@property(nonatomic,retain)NSString *masterMark;
@property(nonatomic,retain)NSString *dateCode;
@property(nonatomic,retain)NSString *dateDescription;
@end
.M
@implementation ItemShow
@synthesize itemYear,KMRef,mintMark,rarity,specialRemark,mintage,dateCode,dateDescription,dateComment,masterMark,availability,quality;
@end
DBACCESSクラスメソッド:
-(NSMutableArray*)getItem:(int)itemID
{
NSMutableArray *itemsArray=[[[NSMutableArray alloc]init]autorelease];
const char *sqlItems=sqlite3_mprintf("SELECT itm.itemYear,itm.KMRef,itm.mintmark,itm.rarity,itm.specialRemark,itm.mintage,dc.dateCode,dc.dateDescription,itm.dateComment,itm.masterMark,av.availability,av.[quality]\
FROM Items as itm, DateCultures as dc, itemAvailability as av\
WHERE dc.dateCultureID=itm.dateCulture AND av.itemID=itm.itemID\
AND itm.itemID=%i",itemID);
sqlite3_stmt *statement;
int sqlResult = sqlite3_prepare_v2(database, sqlItems, -1, &statement, NULL);
if (sqlResult== SQLITE_OK)
{
while (sqlite3_step(statement) == SQLITE_ROW)
{
ItemShow *item=[[Item alloc]init];
char *itemYear=(char *)sqlite3_column_text(statement,0);
item.KMRef=sqlite3_column_int(statement,1);
char *mintmark=(char *)sqlite3_column_text(statement,2);
item.rarity=sqlite3_column_int(statement,3);
char *specialRemark=(char*)sqlite3_column_text(statement,4);
char *mintage=(char *)sqlite3_column_text(statement,5);
char *dateCode=(char *)sqlite3_column_text(statement,6);
char *dateDescription=(char *)sqlite3_column_text(statement,7);
char *dateComment=(char *)sqlite3_column_text(statement,8);
char *masterMark=(char *)sqlite3_column_text(statement,9);
item.availability=sqlite3_column_int(statement,10);
item.quality=sqlite3_column_int(statement,11);
item.itemYear=(itemYear)?[NSString stringWithUTF8String:itemYear]:@"";
item.mintage=(mintage)?[NSString stringWithUTF8String:mintage]:@"Unknown";
item.mintMark=(mintmark)?[NSString stringWithUTF8String:mintmark]:@"";
item.specialRemark=(specialRemark)?[NSString stringWithUTF8String:specialRemark]:@"";
item.dateCode=(dateCode)?[NSString stringWithUTF8String:dateCode]:@"";
item.dateDescription=(dateDescription)?[NSString stringWithUTF8String:dateDescription]:@"";
item.dateComment=(dateComment)?[NSString stringWithUTF8String:dateComment]:@"";
item.masterMark=(masterMark)?[NSString stringWithUTF8String:masterMark]:@"";
[itemsArray addObject:item];
[item release];
}
sqlite3_finalize(statement);
}
else
{
[self dbConnectionError];
}
return itemsArray;
}
したがって、行に
item.KMRef=sqlite3_column_int(statement,1);
私は取得しています
:終了によるキャッチされない例外のアプリ「NSInvalidArgumentException」、理由: - それと間違って何
を「[項目をsetKMRef::]認識されていないセレクタは、インスタンス0x5c767a0に送られましたか」? KMRefはintであり、はである。
何ですか? ItemShow * item = [[アイテム割り当て] init]; – NCFUSN
ああ私の神!私は馬鹿だ! – NCFUSN