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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:04:27+00:00 2026-05-23T17:04:27+00:00

Again, Xcode newb here … So I’m having trouble getting my Items (code not

  • 0

Again, Xcode newb here … So I’m having trouble getting my Items (code not shown but almost identical to the List query) and List arrays to show any data or even count. In the Dbase implementation file I can print out the array … but in UWLAppDelegate I get nothing. I’ve seen examples of this issue on here but they don’t seem to fix the issue. FYI, I’m using Preview Xcode also. So some things might not look right.

I’ve tried initializing as described on here and the tutorial:

    NSMutableArray *tempArray = [[NSMutableArray alloc] init];
self.listArray = tempArray;

… but still no dice.

UWLAppDelegate.m  

- (void)applicationDidFinishLaunching:(UIApplication *)application {
[self copyDatabase];

self.itemArray = [NSMutableArray array];
self.listArray = [NSMutableArray array];

NSLog(@"Items Array: %@",self.itemArray);
NSLog(@"List Array: %@",self.listArray);

[Dbase getDisplayData:[self getDBPath]];
[Dbase getListDisplayData:[self getDBPath]];
}

..

dbase.m

+ (void) getListDisplayData:(NSString *)dbPath {
UWLAppDelegate *appDelegate = (UWLAppDelegate *)[[UIApplication sharedApplication] delegate];
if(sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK){
    const char *sql = "select id, name from lists";
    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, 0);
            Dbase *listObj = [[Dbase alloc] initWithPrimaryKey:primaryKey];
            listObj.dblistname = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 1)];

            listObj.isDirty = NO;

            [appDelegate.listArray addObject:listObj.dblistname];
        }
        //NSLog(@"%@",appDelegate.listArray);
        //NSLog(@"%d", [appDelegate.listArray count]);
    }
} else {
    sqlite3_close(database);
}
}

So the commented NSLog’s will post data all 6 entires/row I’ve made from the App. Ideas?

Objective-C appDelegate array <– didn’t help either. I’ve looked at other similar questions with no avail. Ideas?

  • 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-23T17:04:27+00:00Added an answer on May 23, 2026 at 5:04 pm

    Frankly there doesn’t seem to be a problem. It just seems to be a problem of printing in the wrong order. You have your NSLogs before you collect the data. That seems to be the reason why the arrays are empty in your app delegate method while they are printing in Dbase‘s methods.

    Shouldn’t it be?

    self.itemArray = [NSMutableArray array];
    self.listArray = [NSMutableArray array];
    
    [Dbase getDisplayData:[self getDBPath]];
    [Dbase getListDisplayData:[self getDBPath]];
    
    NSLog(@"Items Array: %@",self.itemArray);
    NSLog(@"List Array: %@",self.listArray);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Once again a very beginner-ish question, but here I go: I would like to
NOTE: THE PROBLEM IS NOT IN THIS CODE, BUT THE ANSWER FOR EXC_BAD_ACCESS is
I'm having some trouble with Xcode. A lot of times I'll just be typing
Once again I'm doing Java graphics (Graphics2D) but I noticed there is no Polygon.Double
how are you all? I'm having a problem with the new XCode and I
When commenting out a piece of code in xcode //code If you click comment
I have downloaded Xcode 4.2 and I'm having problems viewing my project in the
I'm having some weird issues with Xcode, and this is pretty much impossible to
Ever since I started using Xcode, I've experienced extremely annoying problems with Code Sense
I have a really weird problem with Xcode 3.2.5 In a normal code sequence

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.