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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:31:10+00:00 2026-05-27T14:31:10+00:00

In my app, I have: car.h @interface car : NSObject { NSString *model; NSString

  • 0

In my app, I have:

car.h

@interface car : NSObject
{
  NSString *model;
  NSString *price;
  // others atributes

}
@property(nonatomic, retain) NSString *model;
@property(nonatomic, retain) NSString *price;
...

myshop.h

#import "car.h"
@interface myshop : UIViewController...
{
  car *mycar;
}
@property(nonatomic, retain) car *mycar;
...

myshop.m

...
-(void) viewDidLoad
{
   ...
   mycar = [[car alloc] init];
}

so, I have a method that shows a popover, where I can select a car from a tableview. This popover callback a method in the myshop.m, using delegate, where I assign a value to mycar.model, and call the method doA above, all of this works fine, and shows the value of mycar.model in Output:

-(void) doA
{
   NSLog(@"car = %@", mycar.model );
   ...
}

But… now it is the problem: I have a buttom in the myshop view. When I press this button, the action shows an alert view (there is the delegate in .h). The return of this alert calls:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
   [self doA];
   ...
}

And the program crash when doA tries to write mycar.model to Output. No error is showing in Output View of Xcode. In the code, it shows: Thread 1: Program received signal: EXEC_BAD_ACCESS.

I can show as many cars I want from popover view, but when press the button, and the AlertView closes, the program crashes.

Just for test, I call [self doA] in other methods that runs from another class via delegate and always the app craches.

Any idea, what is wrong?

Completing the code

Is there any error here? (this is a method of car.m)

- (void) setValues: (NSDictionary *) data  
{

    model = [data objectForKey:@"model"];
    price = [data objectForKey:@"price"];
    ...

I don’t initialize the properties (model, price, …) anywhere in code.

SOLVED !!!

It was a memory management problem!

I change

model = [data objectForKey:@"model"];

by

model = [[NSString alloc] initWithFormat:@"%@", [data objectForKey:@"model"]];

I hope that I am right now! At least the app seens to work well!

Thanks a lot friends !!!

  • 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-27T14:31:10+00:00Added an answer on May 27, 2026 at 2:31 pm

    You have got a memory management bug somewhere in your code. I don’t know where the bug is, it almost certainly isn’t in the code you posted (it all looks perfect to me).

    Unless you post more code, we can’t help you fix this one.

    I strongly recommend you enable ARC. It’s fairly new, but nowadays it’s old enough everyone should start using it.

    There’s a very good chance your bug will simply go away if you turn ARC on.

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

Sidebar

Related Questions

in a django-tastypie app I have the following Django-models: class Car(models.Model): name=models.CharField('name',max_length=64) class CarTrack(models.Model):
I currently have an app (in Silverlight), using mv-vm, that has an interface to
I have this web app at the http://autozeep.com/cars each car have it's link to
Showing app/views/car/index.html where line #3 raised: You have a nil object when you didn't
I`m building simple app which shows information about most car brands. I have rootViewController
I have a viewModel named CarsList with main property public ObservableCollection<Car> Cars { get
I have been working on a replacement for the stock Car Home app for
In my app have a window splitted by a QSplitter, and I need to
This is a continuation of the question here: JBoss - does app have to
I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1). I

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.