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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:55:23+00:00 2026-05-24T05:55:23+00:00

I had stored custom objects data in Array. I am fetching data from Array

  • 0

I had stored custom objects data in Array. I am fetching data from Array of custom objects in a function. when I am calling function for first time it is working good but When I am calling it again and again I am getting EXC_BAD_ACCESS.

Here is function details.

-(void) facebookDisplayFunction:(int)atIndex {


FacebookWallData *wall = (FacebookWallData *)[facebook_wallDataArray objectAtIndex:atIndex];


NSString *friendID= wall.actor_id;
NSString *linkFetch= wall.permalink;
NSString* postID=wall.postId;

NSNumber *countNumber;

NSString *friendName=@"";
NSString* profileThumImage=@"";

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

    FacebookLikes* countValues=[[FacebookLikes alloc]init];
    countValues=[facebook_LikesArray objectAtIndex:i];

 //   NSLog(@" postId_wall %@  LikePostId = %@",postID,countValues.PostID);
    if([postID isEqualToString:countValues.PostID]) {
        countNumber=countValues.Count;

        if(countNumber>0) 
            friendID=countValues.Friends;

        [countValues release];
        break;
    }

    [countValues release];
}


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

    FacebookFreinds* friendsRecord=[[FacebookFreinds alloc]init];
    friendsRecord=[facebook_FreindsArray objectAtIndex:i];

    if([friendID isEqualToString:friendsRecord.UID]) {
        friendName=friendsRecord.name;
        profileThumImage=friendsRecord.pic_smal;
        [friendsRecord release];
        break;
    }
    [friendsRecord release];
 }

// Adding values in table //





[imageData addObject:@"facebook.png"]; 
[tableList addObject:wall.messages];
[profileUserName addObject:friendName];
[linksOfFacebookData addObject:linkFetch];
[RetweetAndLikeData addObject:@"5"];
[favedProfileThumb addObject:profileThumImage];
[twitterPostID addObject:@""];
[eachPostUID addObject:friendID];

  [wall release];

}

And here I am calling function.
[self facebookDisplayFunction:0];
[self facebookDisplayFunction:0]; // EXC_BAD_ACCESS error here.

  • 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-24T05:55:23+00:00Added an answer on May 24, 2026 at 5:55 am

    Why are you allocating an object like this FacebookLikes* countValues=[[FacebookLikes alloc]init] and then assigning to this same variable the instance inside the array with this code countValues=[facebook_LikesArray objectAtIndex:i] and later on you release it with this [countValues release]? You don’t know what you are doing.

    Try changing this:

    FacebookLikes* countValues=[[FacebookLikes alloc]init];
    countValues=[facebook_LikesArray objectAtIndex:i];
    

    to this

    FacebookLikes* countValues = [facebook_LikesArray objectAtIndex:i];
    

    and remove all occurrences of [countValues release]. Do the same for the friendsRecord in the second for-loop. Also, what is the [wall release]? Remove it!

    You should not allocate any of these objects because you are actually obtaining them from that array, and not creating a new instance. That just creates a leak in your code. You should not release any of these objects because they are retained by the array, and it is responsible for releasing them whenever they are removed from the array or after the array is destroyed/deallocated. Please, rtfm

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

Sidebar

Related Questions

Recently I had to do some very processing heavy stuff with data stored in
Does anyone know if NHibernate supports returning output parameters from stored procedures? I've had
Using Script Task, I had stored data ie a Dataset or Datatable object to
I had a heated discussion with a colleague on the usage of stored procedures
Had a page that was working fine. Only change I made was to add
I am trying to create a custom UIView that is stored in a nib
So, I am working on a demo web dashboard. Previously, I had been using
I have an custom class for an Core Data entity, called 'Friends'. As I
Back in C I had a custom black red tree implementation to store/insert/search/etc a
I had an original data model that was used to create NSManagedObject subclasses. 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.