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 4613564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:34:12+00:00 2026-05-22T01:34:12+00:00

I have the following problem while i scroll the table view: NSCFString objectAtIndex:]: unrecognized

  • 0

I have the following problem while i scroll the table view:

NSCFString objectAtIndex:]: unrecognized selector sent to instance

I create NSDictionary tableContents and when i scroll it becomes deallocated.
This is my code:

- (void)viewDidLoad {

lessonsInGroup1 = [NSMutableArray array];
lessonsInGroup2 = [NSMutableArray array];
lessonsInGroup1 = [self grabRowsInGroup:@"1"];
lessonsInGroup2 = [self grabRowsInGroup:@"2"];

NSDictionary *temp =[[NSDictionary alloc]initWithObjectsAndKeys:lessonsInGroup1,@"General Information",lessonsInGroup2,@"LaTeX Examples", nil];
//[[tableContents alloc] init];
self.tableContents =temp;
[temp release];
NSLog(@"table %@",self.tableContents);
NSLog(@"table with Keys %@",[self.tableContents allKeys]);

self.sortedKeys =[[self.tableContents allKeys] sortedArrayUsingSelector:@selector(compare:)];
NSLog(@"sorted %@",self.sortedKeys);

[lessonsInGroup1 release];
[lessonsInGroup2 release];

//[table reloadData];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;

[super viewDidLoad];

}

- (NSMutableArray *) grabRowsInGroup:(NSString*)GroupID{

NSMutableArray *groupOfLessons; 
groupOfLessons = [[NSMutableArray alloc] init];
char *sqlStatement;
int returnCode;
sqlite3_stmt *statement;
NSString *databaseName;
NSString *databasePath;

// Setup some globals
databaseName = @"TexDatabase.sql";

// 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;

// Open the database from the users filessytem
if(sqlite3_open([databasePath UTF8String], &database) != SQLITE_OK) {
    fprintf(stderr, "Error in opening the database. Error: %s",
            sqlite3_errmsg(database));
    sqlite3_close(database);
    return;
}
sqlStatement = sqlite3_mprintf(
                               "SELECT * FROM Lessons WHERE LessonGroup = '%s';", [GroupID UTF8String]);

returnCode =
sqlite3_prepare_v2(database,
                   sqlStatement, strlen(sqlStatement),
                   &statement, NULL);
if(returnCode != SQLITE_OK) {
    fprintf(stderr, "Error in preparation of query. Error: %s",
            sqlite3_errmsg(database));
    sqlite3_close(database);
    return;
}
returnCode = sqlite3_step(statement);
while(returnCode == SQLITE_ROW) {

    NSString *aLessonID = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)];
    NSString *aLessonGroup = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)];
    NSString *aLessonTopic = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)];
    NSString *aLessonText = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 3)];
    NSString *aLessonCode = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 4)];
    NSString *aLessonPicture = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 5)];

    /*NSLog(aLessonID);
    NSLog(aLessonGroup);
    NSLog(aLessonTopic);
    NSLog(aLessonText);
    NSLog(aLessonCode);
    NSLog(aLessonPicture);*/

    // Create a new busCit object with the data from the database
    Lesson *lesson = [[Lesson alloc] initWithLessonID:aLessonID LessonGroup:aLessonGroup LessonTopic:aLessonTopic LessonText:aLessonText LessonCode:aLessonCode LessonPicture:aLessonPicture];

    [groupOfLessons addObject:lesson];

    returnCode = sqlite3_step(statement);
}
sqlite3_finalize(statement);
sqlite3_free(sqlStatement);

return [groupOfLessons autorelease];

}

  • 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-22T01:34:13+00:00Added an answer on May 22, 2026 at 1:34 am

    What does your @property for tableofContents look like?

    Also, you are going to run into issues with

    [lessonsInGroup1 release];
    [lessonsInGroup2 release];
    

    because you are autoreleasing those in the grabRowsInGroup:

    So, you don’t need to call release them.

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

Sidebar

Related Questions

Let say I have the following desire, to simplify the IConvertible's to allow me
I have a script that appends some rows to a table. One of the
I have a snippet to create a 'Like' button for our news site: <iframe
My question is about memory use and objects in actionscript 2. If I have
I have a project that adds elements to an AutoCad drawing. I noticed that
I have a new web app that is packaged as a WAR as part
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
I have found this example on StackOverflow: var people = new List<Person> { new
I am attempting to pull some information from my tnsnames file using regex. I
After having read Ian Boyd 's constructor series questions ( 1 , 2 ,

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.