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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:50:14+00:00 2026-06-09T11:50:14+00:00

I have NSArray elements which is implemented from NSSet and if i tried to

  • 0

I have NSArray elements which is implemented from NSSet and if i tried to display the elements in Table View Cell i’m getting BAD ACCESS issue at tableView numberOfRowsInSection part.Here is my code

- (void)viewDidLoad
{
[super viewDidLoad];




jsonurl=[NSURL URLWithString:@"http://www.sample.net/products.php"];//NSURL

jsondata=[[NSString alloc]initWithContentsOfURL:jsonurl];//NSString
jsonarray=[[NSMutableArray alloc]init];//NSMutableArray

self.jsonarray=[jsondata JSONValue];

array=[jsonarray valueForKey:@"post_title"];

set = [NSSet setWithArray:array];//NSMutableSet
array=[set allObjects];//NSArray


NSLog(@"%@",array);



}


#pragma mark - Table view data source

  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [array count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil)  
{        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];



}
// Configure the cell...

cell.textLabel.text = [self.array objectAtIndex: [indexPath row]];    
return cell;
}

Kindly help please.Thanks in advance.

  • 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-06-09T11:50:15+00:00Added an answer on June 9, 2026 at 11:50 am

    In your code you are not allocating the array. You are setting an autoreleased object to that array that’s why you are getting this error.

    Replace array=[set allObjects]; with array=[[set allObjects] retain];

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

Sidebar

Related Questions

I have a couple of rows in a table view which I like to
I have a table view with 3 items, one of which I have behind
I have a newbie question regarding when to release the elements of a NSArray.
I have a NSMutableArray and a NSArray . Both consist of elements that are
I have NSArray and I want to remove duplicates from it. I know that
I have an NSArray of NSDictionary objects which I would like to be able
i have an NSArray which contains custom objects, the objects have an NSString property,
Now I have a 1-dimonsion NSArray, each element of which is a NSMangedObject with
Really beginner question here. I have an NSArray of images which in its last
I have a database manager which successfully loads a string from my sqlite database,

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.