Question

I am doing a lot of inserts in my sqlite db. For some reason, at a specific point, the app crashes. I checked the insert command - everything is fine. If I run it on an iPhone 4 device - it runs perfectly.

The problem is that I don't get any error messages, not even memory warnings. xCode seems to still run, but on the device, the app crashes.

This is my code:

    sqlite3_stmt *compiledStatement;
    for (UpdateItems *one in arrList) {
        NSString *stat;
        stat = [[NSString alloc] initWithFormat:@"insert into table values (null, (select id from t1 where code='%@'), (select id from t2 where c='%@'), '%@', '%@', '%@', '%@', '%@', '%@')", one.bk, one.code, one.data, one.b, one.bV, one.s, one.sV, one.o];
        if(sqlite3_prepare_v2(database, [stat UTF8String], -1, &compiledStatement, NULL) == SQLITE_OK)
        {
            while(YES){
                NSInteger result = sqlite3_step(compiledStatement);
                printf("db error: %s\n", sqlite3_errmsg(database)); 
                if(result == SQLITE_DONE){
                    index = index + 1;
                    double totalPrc = 0.75f + roundf(((double) index / totalRecords) / (100 / 20) * 100.0f) / 100.0f;
                    if (self.percentageCompleted != totalPrc) {
                        self.percentageCompleted = totalPrc;
                        [self performSelectorOnMainThread:@selector(refreshHUD) withObject:nil waitUntilDone:NO];
                    }
                    break;
                }
                else if(result != SQLITE_BUSY){
                    printf("db error: %s\n", sqlite3_errmsg(database)); 
                    break;
                }
            }
            sqlite3_reset(compiledStatement);
        }
        [stat release];
    }

How can I track this, to see what is the problem?

Était-ce utile?

La solution

You might not see anything on xcode console, what about device crash logs ? Whenever there is a crash, crash reporter generates a crash report. Use XCode organizer to bring up device logs, symbolicate them

Autres conseils

If the App that crashed was built with: stripping debug symbols - NO:

a nice symbolicated crash log should appear in your organizer window giving a stack trace, etc:

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top