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

  • Home
  • SEARCH
  • 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 838467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:18:35+00:00 2026-05-15T05:18:35+00:00

i have a problem. When i compile my program there isn’t a error but,

  • 0

i have a problem.
When i compile my program there isn’t a error but, when i start it these retern with “EXC_BAD_ACCESS”.
I looking for the error with the debug and i find it in these method but i don’t understand where…

PS:the program enters in the loop sometimes.

-(void)updateMinPosition{

    float valueMinX = 150;
    float valueMinY = 150;
    float valueMinZ = 150;

    NSString *nameMinimoX = [NSString   stringWithFormat:@"default"];
    NSString *nameMinimoY = [NSString   stringWithFormat:@"default"];
    NSString *nameMinimoZ = [NSString   stringWithFormat:@"default"];

    for(int i = 0; i< [arrayPosizioniMovimento count]; i++){

        //Posizione is my class. It contain a NSString name, 3 float valueX, valueY, valueZ
        Posizione *tempPosition;
        tempPosition = [[Posizione alloc]init];

        tempPosition = [arrayPosizioniMovimento objectAtIndex:i];

        if(tempPosition.valueX <= valueMinX){
            valueMinX = tempPosition.valueX;
            nameMinimoX = tempPosition.nome;
        }

        if(tempPosition.valueY <= valueMinY){
            valueMinY = tempPosition.valueY;
            nameMinimoY = tempPosition.nome;
        }

        if(tempPosition.valueZ <= valueMinZ){
            valueMinZ = tempPosition.valueZ;
            nameMinimoZ = tempPosition.nome;
        }

        [tempPosition dealloc];
    }

    labelMinX.text = nameMinimoX;
    labelMinY.text = nameMinimoY;
    labelMinZ.text = nameMinimoZ;   
}
  • 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-15T05:18:36+00:00Added an answer on May 15, 2026 at 5:18 am

    For the 1st glance there’re several problems with your code:

        Posizione *tempPosition;
        tempPosition = [[Posizione alloc]init];
    
        tempPosition = [arrayPosizioniMovimento objectAtIndex:i];
    

    Here in the second line you create new Posizione instance and right after that assign another value to the same variable. In effect that will mean that your created instance will be never used and cause memory leak. To use element from array just write

    Posizione *tempPosition = [arrayPosizioniMovimento objectAtIndex:i];
    

    The second one – is the following line

    [tempPosition dealloc];
    

    First of all you should never call this method directly but rather send an object -release message – it will be deallocated automatically when its retain count becomes 0. In your case you do not retain tempPosition object in that code so there;s no need to release it here – just remove that line.

    P.S. Using fast enumeration can also make your code more readable and less error prone:

    for (Posizione *tempPosition in arrayPosizioniMovimento){
       if(tempPosition.valueX <= valueMinX){
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 430k
  • Answers 430k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can always set the frame programmatically. //create a map… May 15, 2026 at 1:59 pm
  • Editorial Team
    Editorial Team added an answer This line in your script is incorrect: Set MyFile =… May 15, 2026 at 1:59 pm
  • Editorial Team
    Editorial Team added an answer I think it's because CSS wasn't really perceived as a… May 15, 2026 at 1:59 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.