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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:27:39+00:00 2026-05-20T12:27:39+00:00

Notice in the code below, the two NSLOG statements. The aaa gets printed out

  • 0

Notice in the code below, the two NSLOG statements. The “aaa” gets printed out but the “bbb” never does. Instead, the simulator crashes with EXC_BAD_ACCESS. I know that this typically means that the object I am trying to access has been prematurely released. I just can’t figure out what is wrong…

Updated:

here is my .h

#import <UIKit/UIKit.h>


@interface vcAddCat : UIViewController  <UIPickerViewDataSource, UIPickerViewDelegate> {

NSManagedObjectContext *managedObjectContext;

IBOutlet UIPickerView * pickerView;
NSArray * _weights;
NSArray * _categories;
IBOutlet UILabel *lastCat;
IBOutlet UILabel *lastWeight;

}

I do not have any @property or @synthesize lines for either array…

Here are two snips from my .m

- (void)viewDidLoad {

    [super viewDidLoad];
    NSLog(@">>> Entering %s <<<", __PRETTY_FUNCTION__);

    _categories=[[NSArray alloc] initWithObjects: @"Homework",@"Quizzes",@"Tests", @"Mid-Term Exam", nil];
;

    NSLog(@"aaa");

    _weights=[[NSArray alloc] initWithObjects: @"1",@"2",@"3",@"4", @"5", @"6", @"7", @"8", @"9", @"10", @"11", @"11", @"12", @"13", @"14", @"15", @"16", @"17", @"18", @"19", @"20", @"21",@"22",@"23", @"24", @"25", nil];


    NSLog(@"bbb");

..and here is where I release the arrays…

- (void)dealloc {
[super dealloc];
[_categories release];
[_weights release];
NSLog(@">>> Leaving %s <<<", __PRETTY_FUNCTION__);

}

  • 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-20T12:27:40+00:00Added an answer on May 20, 2026 at 12:27 pm

    OK – loser alert.

    Sorry, guys. All was working when I tested early on with only 10 objects to insert. Once I got it going, I added the rest of the objects (11 – 100) and that’s when it crashed. When I posted the code above, I truncated the object list at 25 items – too redundant, it seemed.

    Well, objects 26, 36, 46, etc all had a typo in them where I’d omitted the preceding ‘@’ before the string value.

    Fixed that and I’m back on track.

    Thanks for your help and sorry about the lame error.

    Phil

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

Sidebar

Related Questions

I notice that modern C and C++ code seems to use size_t instead of
Python is pretty clean, and I can code neat apps quickly. But I notice
I have noticed that my geocoder is inconsistent in the code shown below because
I was writing some code, and I notice a pattern in the exception handling
I noticed some code of a colleague today that initialized class variables in the
In Silverlight I noticed that the code-behind Page class inherits from UserControl: public partial
I was just writing some quick code and noticed this complier error Using the
I'm currently maintaining some flex code and noticed very many functions which are declared
I noticed by looking at sample code from Apple, that they tend to design
I noticed using task manager that the following code has a GDI leak in

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.