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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:13:36+00:00 2026-06-16T03:13:36+00:00

I have a simple UICollectionView based app – one UICollectionView and a NSMutableArray based

  • 0

I have a simple UICollectionView based app – one UICollectionView and a NSMutableArray based data model for simplicity.

I can delete cells with no problem via the didSelectItemAtIndexPath: delegate method:

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    [self.data removeObjectAtIndex:[indexPath row]];
    [self.collectionView deleteItemsAtIndexPaths:@[indexPath]];
}

However, I’m trying to add a delete option via a UIMenuController in a UICollectionViewCell subclass which is triggered via a UILongPressGestureRecognizer which all works fine and I successfully trigger an NSNotification

-(void)delete:(id)sender{
      NSLog(@"Sending deleteme message");
      [[NSNotificationCenter defaultCenter] postNotificationName:@"DeleteMe!" object:self userInfo:nil];
}

I catch it in my ViewController and call the following method:

-(void)deleteCell:(NSNotification*)note{
       MyCollectionViewCell *cell = [note object];
       NSIndexPath *path = nil;
       if((path = [self.collectionView indexPathForCell:cell]) != nil){
           [self.data removeObjectAtIndex:[path row]];
           [self.collectionView deleteItemsAtIndexPaths:@[path]];
       }
}

And it crashes on the deleteItemsAtIndexPaths: call

-[UICollectionViewUpdateItem action]: unrecognized selector sent to instance 0xee7eb10

I’ve checked everything obvious – like the object from NSNotification and the indexPath created from the indexPathForCell: call and it all seems totally fine. It seems like I’m calling deleteItemsAtIndexPath: with the same information in both places, but for some reason it fails when it goes via the notification route.

This is the info at the address given in the error:

(lldb) po 0xee7eb10
(int) $1 = 250080016 <UICollectionViewUpdateItem: 0xee7eb10> index path before update (<NSIndexPath 0x9283a20> 2 indexes [0, 0]) index path after update ((null)) action (delete)

Perhaps the index path after update being null is significant…

Any ideas?

  • 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-16T03:13:38+00:00Added an answer on June 16, 2026 at 3:13 am

    I found a crude but working workaround, and it even checks if action is already implemented in a future release (better than a category)

    // Fixes the missing action method when the keyboard is visible
    #import <objc/runtime.h>
    #import <objc/message.h>
    __attribute__((constructor)) static void PSPDFFixCollectionViewUpdateItemWhenKeyboardIsDisplayed(void) {
        @autoreleasepool {
        if ([UICollectionViewUpdateItem class] == nil) return; // pre-iOS6.
        if (![UICollectionViewUpdateItem instancesRespondToSelector:@selector(action)]) {
                IMP updateIMP = imp_implementationWithBlock(^(id _self) {});
                Method method = class_getInstanceMethod([UICollectionViewUpdateItem class], @selector(action));
                const char *encoding = method_getTypeEncoding(method);
                if (!class_addMethod([UICollectionViewUpdateItem class], @selector(action), updateIMP, encoding)) {
                    NSLog(@"Failed to add action: workaround");
                }
            }
        }
    }
    

    Edit: Added check for iOS5.
    Edit2: We’re shipping that in lots of commercial projects (http://pspdfkit.com) and it works great.

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

Sidebar

Related Questions

Have simple C# console app which imports text data into SQL. It takes around
I have simple html site. how I can fix the problem 'The requested URL
I have simple database - one table with 6 collumns. 3 of them i
I have simple problem as I am not much familiar with Java GUI. I
I have simple WCF Service Application (based on this tutorial : Getting Started ).
I have simple chat program using WCF service. One service use for server and
I have simple test project which creates a frame and adds one JTextPane to
I have simple ASP.NET MVC action like this : public ActionResult Edit(EditPostViewModel data) {
I have simple queue worker based on standard AMQP Class from PHP. It works
I have simple example: data = data.replace(/\/\*(.*?)\*\//g,) How to ignore newlines in this regexp

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.