I’ve a NSMutableArray and I’m assigning object to it like [appDelegate.array addObject:Obj]; when i call NSLog(@"appdelegate.array %@ ", [appdelegate.array description]) ; I’m getting like this in consol
(
"<Item: 0x6c8b650; frame = (0 0; 0 0); transform = [0, 0, 0, 0, 0, 0]; alpha = 0; opaque = NO; layer = (null)>",
"<Item: 0x6b825c0; frame = (0 0; 0 0); transform = [0, 0, 0, 0, 0, 0]; alpha = 0; opaque = NO; layer = (null)>",
"<Item: 0x6b82ad0; frame = (0 0; 0 0); transform = [0, 0, 0, 0, 0, 0]; alpha = 0; opaque = NO; layer = (null)>"
)
Can any one suggest me to correct format to add objects and why array contains frame = (0 0; 0 0); transform = [0, 0, 0, 0, 0, 0]; alpha = 0; opaque = NO; layer = (null) ??
+ (void) getInitialCurrencyToDisplay:(NSString *)dbPath{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) {
const char *sql = "select c_name,C_Id from Currency";
sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {
while(sqlite3_step(selectstmt) == SQLITE_ROW) {
NSInteger primaryKey = sqlite3_column_int(selectstmt, 1);
Currency *Obj = [[Currency alloc]initWithPrimaryKey:primaryKey];
Obj.C_Name = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 0)];
Obj.address=[NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 1)];
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSLog(@"%@", documentsDir);
NSString *pngFilePath = [NSString stringWithFormat:@"%@/%@.png",documentsDir, Obj.C_Name];
Obj.C_Image = [[UIImage alloc] initWithContentsOfFile:pngFilePath];
Obj.isDirty = NO;
[appDelegate.array addObject:Obj];
}
}
I used above code to get data from Database
Thanks in Advance
Check the parent class of your
Currencyclass. The parent class should beNSObjectand notUIViewor similar.And please have a look at the Objective-C naming conventions. Only classes should start with a capital letter.