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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:13:22+00:00 2026-05-27T05:13:22+00:00

I have this bug in Obj-C that is caused because the program is trying

  • 0
  1. I have this bug in Obj-C that is caused because the program is trying to access a non-existing NSArray key.
  2. Typically in my PHP programs I verify that a key exists before using it using array_key_exists(NEEDLE, HAYSTACK).
  3. Is there an equivalent in Cocoa / Obj-C for these two functions, and if not, how would you go about creating these.
  4. I am more interested in a solution for array_key_exists() than in array_search().
  • 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-27T05:13:22+00:00Added an answer on May 27, 2026 at 5:13 am

    In an NSArray, keys can only be integers. So you can simply check whether the index you are trying to access is less than the number of items in the array. You can check the number of items via the count method:

    NSArray *array = ... some array ... 
    NSUInteger index = ... some index ...
    
    if (index < [array count]) {
         // It's safe to do [array objectAtIndex:index]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have this bug that only appears 30% of the time for the Release
I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html Well, at
I notice that a lot of layouts on the internet now have this bug.
I have this form in my view: <!-- Bug (extra 'i') right here-----------v -->
I have some data, like this: BUG DATE STATUS ---- ---------------------- -------- 9012 18/03/2008
This is a registered bug ( Bug ID: 6515708 ) but does anyone have
I have this code in jQuery, that I want to reimplement with the prototype
I have this really weird bug. When I scroll down my table view, down
I have this weird bug, where C++ calls the wrong function: So this bit
I have made a program that has a Toolbar with a few actions on

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.