Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4601966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:54:31+00:00 2026-05-21T23:54:31+00:00

I have a really strange one. I have a method that works perfectly fine,

  • 0

I have a really strange one. I have a method that works perfectly fine, but I am trying to convert it to make the data more database driven vs the hardcoding that currently exists. When I add a call to my database method to pull the data, I’m getting an EXC_BAD_ACCESS long AFTER the database stuff is done. I’ve narrowed it down to the database stuff, since if I don’t make the call at all, the crash doesn’t happen.

So, the call to the method looks like this (this is where if I comment out, it doesn’t crash):

NSString *thisRoomNumber = [self readLocationsFromDatabaseBetweenPoints:fX YPoint:fY];

and the method itself looks like this:

    #pragma mark -
#pragma mark SQL Operations
- (NSString *)readLocationsFromDatabaseBetweenPoints:(float)tapPointX YPoint:(float)tapPointY{

    // Setup some globals
    databaseName = @"db.sqlite";

    // Get the path to the documents directory and append the databaseName
    NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir = [documentPaths objectAtIndex:0];
    databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

    // Setup the database object
    sqlite3 *database;

    NSString *sqlStringBuilder = [NSString stringWithFormat:@"select * from floors where propertyid = ? and floorid = ? and %f between topleftxcoord and bottomrightxcoord and %f between topleftycoord and bottomrightycoord", tapPointX, tapPointY];

    NSString *roomNumber = @"0";

    // Open the database from the users filessytem
    if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
        // Setup the SQL Statement and compile it for faster access
        const char *sqlStatement =  [sqlStringBuilder UTF8String];

        NSLog(@"%@", [NSString stringWithUTF8String:sqlStatement]);

        sqlite3_stmt *compiledStatement;
        if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
            sqlite3_bind_int(compiledStatement, 1, iPropertyId);
            sqlite3_bind_int(compiledStatement, 2, iFloorId);           

            // Loop through the results and add them to the feeds array
            while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
                // Read the data from the result row
                NSInteger aLocId = sqlite3_column_int(compiledStatement, 0);
                NSInteger aTLX = sqlite3_column_int(compiledStatement, 1);
                NSInteger aTLY = sqlite3_column_int(compiledStatement, 2);
                NSInteger aBRX = sqlite3_column_int(compiledStatement, 3);
                NSInteger aBRY = sqlite3_column_int(compiledStatement, 4);
                NSString *aRoomIdent = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 5)];

                roomNumber = aRoomIdent;

            }
        }else{
            NSLog(@"%d", sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL));
        }
        // Release the compiled statement from memory
        sqlite3_finalize(compiledStatement);

    }
    sqlite3_close(database);


    [documentsDir release];
    [documentPaths release];
    //[roomNumber release];
    [sqlStringBuilder release];

    return roomNumber;
}

The call itself works fine. I get the results as expected, the “thisRoomNumber” comes back with what I expect it to be. Once the calling method kicks out to the next part it goes back to the delegate, at which point it crashes. I know it’s tough to see whats going on without a lot of code to use, but the sheer amount of code would make this post MASSIVE.

Hopefully this will give us a starting point to fixing this. Also, the crash log dump gives absolutely nothing useful for this.

Thanks for any help you guys can provide! If you need more info, let me know, I’ll do my best to add to this as needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T23:54:32+00:00Added an answer on May 21, 2026 at 11:54 pm

    Your release calls at the end are the problem. You’re releasing objects that aren’t owned by you. Remove them and you should be fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I spent few hours trying to resolve one very strange issue, but I really
I'm experiencing something really strange! I have a div that I'm hiding with JS
I have a kind of strange thing that I really nead for my text
Getting something really strange that I just can't work out. I have 3 methods
I know there is more than one question out there that matches this, but
This is a really strange one. I am trying to add a cache value
I'm facing a really strange problem that has me smoked. I have a fairly
I'm having a really strange problem. Here is the code I have that should
I have an iPhone app and one of my users found a really strange
I have a really strange issue. I am working on a Java SWING application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.