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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:22:11+00:00 2026-06-05T23:22:11+00:00

I have a UITableView that lists comments from various users. I save all of

  • 0

I have a UITableView that lists comments from various users. I save all of the comments to Core Data. I have also implemented NSFetchedResultsController. One of the properties of comments is username – the user who made the comment.

I only want users to be able to delete their own comments. Here is my code:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
  //Only be able to delete user generated cells
  Comment *comment = [[self fetchedResultsController]objectAtIndexPath:indexPath];
  if (comment.username != self.username) {
    return NO;
  }
  return YES;
}

performfetch is called in viewDidLoad

When the CommentsViewController is loaded and new comments are created, the functionality works. However, if there were any previous comments, those comments cannot be edited even though the user has created them.

Any thoughts on what might be going on?

  • 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-05T23:22:13+00:00Added an answer on June 5, 2026 at 11:22 pm

    I think the issue is the deep equality check on the username. Assuming those are strings, you don’t want to test if they are the very same object (they will be in one fetch, and won’t be between runs). You want to test shallow equality…

    if (![comment.username isEqualToString:self.username]) { // and so on...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableview cell that gets a tally from a core data database.
I have a UITableView that displays various nsstrings from a custom object called a
I have a view controller that lists some data in an UITableView . To
So I have a subclassed UITableView that lists data. I need to make only
I have a UITableView that displays some data that is read in at runtime
I have a Core Data backed table view, that show a list of editable
Hi All I have a UITableView with the list of items fetched from sqllite.
I have a UITableView I'm populating with data from CoreData. I have a data
I have a UITableView populated by a feed from searchtwitter.com. I also have a
I have a UITableView populated with a mutablearray that is read from NSUserDefaults. 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.