Register x1 is not available

Hi at all,

i have update my xcode to 7.1 version to run my app (USAG app) on iOS 9.1.

When I run the app and use a function that accesses the internal database , the app crashes.

The error message is as follows : EXC_BAD_ACCESS and the database register is "not available".

Here's the code and a screenshot

Post the symbolicated crash log.

(Your post didn't show the code nor screenshot).

This is the code:

NSArray *)getFirstClassifications
{
    sqlite3 *database;


    NSMutableArray *result = [[NSMutableArray alloc] init];


if(sqlite3_open([databasePath UTF8String], &database)== SQLITE_OK) {
        const char *sqlStatement;
            if([[self getCurrentLanguage] isEqualToString:@"it-IT"] || [[self getCurrentLanguage] isEqualToString:@"it"])
        {
            sqlStatement = "select a.id, title_it, flag_new, promo_list, path, type from firstclassifications a left join images b on a.images_id_it=b.id ";
        }
        else
        {
            sqlStatement = "select a.id, title_en, flag_new, promo_list, path, type from firstclassifications a left join images b on a.images_id_en=b.id ";
        }
    
        sqlite3_stmt *compiledStatement;
        if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
          
            while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
          
                NSInteger uid = sqlite3_column_int(compiledStatement, 0);
                NSString *titleIt = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
                BOOL flagNew = sqlite3_column_int(compiledStatement, 2);
                NSString *promoList = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];
            
                NSString *imagePath =[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 4)];
                NSString *imageFullPath = [NSString stringWithFormat:@"ipad_img_1/%@",imagePath];
               FirstClassification *fc = [[FirstClassification alloc] initWithParams:uid titleIt:titleIt flagNew:flagNew promoList:promoList imagePath:imageFullPath];
                [result addObject:fc];
            }
        }

        sqlite3_finalize(compiledStatement);
    }
    sqlite3_close(database);

    return  result;
}

The error message is shown at the line 9 and the error message shown is:"EXC_BAD_ACCESS".

The object database show this log:" (sqlite3 *) database = <register x1 is not available>"

1. That code won't compile.

2. Post the symbolicated crash log.

How can i create the symbolicated crash log?Thanks

Xcode/Window/Devices/View Device Logs

That isn't symbolicated.

If it were, we would be seeing source code line numbers whereever your app name 'usagApp' appears.

It's not necessary to point the binary images.

I have seen that the variable "database" is always null!

How can i solve the problem?

Thanks

Anyone can help me?

Post the symbolicated crash log like I asked you to.

There's not much help anyone can provide you because, according to the code you've provided, the likely scenarios are:

1. Your database path is incorrect and thus line 9 is failing.

2. You changed something in your code and now getFirstClassifications is being called before databasePath has been initialized to the right value, and thus line 9 is failing.


To be blunt, if your code on line 31 is any indication--the line where you construct a file path using -stringWithFormat instead of either appending path components or using a bundle search path--there's any number of variations of case one or two that could be true.

"register x1 is not available" seems suspicious - how are you including sqlite? Are you using the built-in library included with the OS, or statically linking your own, or ???

The message "register x1 is not available" is an Xcode/lldb 'feature'. It's a message that the variable would be stored in that register, but due to optimization currently isn't.


If you do a search for "register XY is not available" or "register %@ is not available" you can find a discussion of the matter.

Good to know. So does this sound more like a compiler bug that could possibly be worked around by trivial code changes, or perhaps a build setting to change the optimization level?

To be honest, it doesn't sound like a compiler bug at all. It sounds more like "My app crashed, and I don't understand why" with the addition of random, assorted technical details. The sort of typical calamity one expects to see for someone learning C or Objective-C. :-/

True enough. Since we still haven't seen a symbolicated crash log, we are all just guessing at this point.

Register x1 is not available
 
 
Q