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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:31:34+00:00 2026-05-26T02:31:34+00:00

I am creating a program that requires me to build an NSMutable array and

  • 0

I am creating a program that requires me to build an NSMutable array and then add objects to that array as buttons are clicked.

After the user has clicked all the buttons that they want (therefore adding all the objects that they need into the mutable array) I need to sort the array based on the objects name.
The objects are NSImageViews that are added to the array with names like view1, view2, view40.
I need a way to sort the objects in the array according to the numbers in the last digit of their name.
I was using

[nameOfArray sortUsingSelector:@selector(caseInsensitiveCompare:)];

but when I run the app I get SIGABRT at that line.

I have looked at many many other threads and can not find a solution.

Any help is greatly appreciated, as I have been working on this for several weeks now,
Anybody know what I am doing wrong?

EDIT , Here is what the debugger said afterwords

2011-09-30 08:16:06.669 CAP helper[9874:b303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView caseInsensitiveCompare:]: unrecognized selector sent to instance 0x4e5f650'
*** Call stack at first throw:
(
0   CoreFoundation                      0x00de05a9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x00f34313 objc_exception_throw + 44
2   CoreFoundation                      0x00de20bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3   CoreFoundation                      0x00d51966 ___forwarding___ + 966
4   CoreFoundation                      0x00d51522 _CF_forwarding_prep_0 + 50
5   CoreFoundation                      0x00d472f6 __CFSimpleMergeSort + 374
6   CoreFoundation                      0x00d4706c CFSortIndexes + 268
7   CoreFoundation                      0x00dda642 -[NSMutableArray sortRange:options:usingComparator:] + 274
8   CoreFoundation                      0x00d598cf -[NSMutableArray sortWithOptions:usingComparator:] + 95
9   CoreFoundation                      0x00d5983c -[NSMutableArray sortUsingSelector:] + 108
10  CAP helper                          0x0000cf81 -[RibbonStacker stackit:] + 305
11  UIKit                               0x000324fd -[UIApplication sendAction:to:from:forEvent:] + 119
12  UIKit                               0x000c2799 -[UIControl sendAction:to:forEvent:] + 67
13  UIKit                               0x000c4c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
14  UIKit                               0x000c37d8 -[UIControl touchesEnded:withEvent:] + 458
15  UIKit                               0x00056ded -[UIWindow _sendTouchesForEvent:] + 567
16  UIKit                               0x00037c37 -[UIApplication sendEvent:] + 447
17  UIKit                               0x0003cf2e _UIApplicationHandleEvent + 7576
18  GraphicsServices                    0x01019992 PurpleEventCallback + 1550
19  CoreFoundation                      0x00dc1944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
20  CoreFoundation                      0x00d21cf7 __CFRunLoopDoSource1 + 215
21  CoreFoundation                      0x00d1ef83 __CFRunLoopRun + 979
22  CoreFoundation                      0x00d1e840 CFRunLoopRunSpecific + 208
23  CoreFoundation                      0x00d1e761 CFRunLoopRunInMode + 97
24  GraphicsServices                    0x010181c4 GSEventRunModal + 217
25  GraphicsServices                    0x01018289 GSEventRun + 115
26  UIKit                               0x00040c93 UIApplicationMain + 1160
27  CAP helper                          0x00002219 main + 121
28  CAP helper                          0x00002195 start + 53
29  ???                                 0x00000001 0x0 + 1
)
terminate called throwing an exception
Current language:  auto; currently objective-c>
  • 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-26T02:31:34+00:00Added an answer on May 26, 2026 at 2:31 am

    Your array contains UIImageViews and your sort calls caseInsensitiveCompare: on those instances of UIImageView, but that class doesn’t have any method by that name. You should do something like this:

    [nameOfArray sortUsingComparator:^(id obj1, id obj2) {
        UIImageView *view1 = obj1;
        UIImageView *view2 = obj2;
    
        // Somehow compare the views and return NSOrderedAscending,
        // NSOrderedDescending or NSOrderedSame, for example by calling
        // appropriate "compare:" methods.
        return myComparisonResult
    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a program that needs to store the user's data in encrypted
I'm creating a program where the user has the option of creating their own
I am creating a really basic program, that has a method to fill an
I am creating this program that requires the recalculation of a RichTextBox control's width.
I'm updating a program for my company that requires the user to have SQL
I am creating a program that will be installed using the .net installer project.
I am creating a program that displays a popup at certain times (just like
I'm creating a program that authenticates from a before it runs. I also want
I have been tasked with creating a program that will generate an amortization schedule.
Let's say I'm creating a program in C that needs to use a tempfile.

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.