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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:10:13+00:00 2026-05-14T20:10:13+00:00

I am trying to debug an application that is throwing up strange (to my

  • 0

I am trying to debug an application that is throwing up strange (to my untutored eyed) errors. When I try to simply log the count of an array…

NSLog(@"Array has %i items", [[self startingPlayers] count]);

…I sometimes get an error:

-[NSCFString count]: unrecognized selector sent to instance 0x1002af600

or other times

-[NSConcreteNotification count]: unrecognized selector sent to instance 0x1002af600

I am not sending ‘count’ to any NSString or NSNotification, and this line of code works fine normally.

A Theory…

Although the error varies, the crash happens at predictable times, immediately after I have run through some other code where I’m thinking I might have a memory management issue. Is it possible that the object reference is still pointing to something that is meant to be destroyed? Sorry if my terms are off, but perhaps it’s expecting the array at the address it calls ‘count’ on, but finds another previous object that shouldn’t still be there (eg an NSString)? Would this cause the problem?

If so, what is the most efficient way to debug and find out what is that address? Most of my debugging up until now involves inserting NSLogs, so this would be a good opportunity to learn how to use the debugger.

  • 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-14T20:10:14+00:00Added an answer on May 14, 2026 at 8:10 pm

    This is a sign that the memory location at which your code is expecting your array to live has either:

    1. Been deallocated and another variable has been allocated in the same place
    2. Been clobbered by some bad code

    My bet would be on the first one. You’ll want to carefully look at where you are allocating the array and make sure that you’re not allowing its retain count to reach zero.

    Remember that if you’re allocating the array using a convenience method (basically one that starts with array) and not either retaining it or assigning it using dot notation (e.g. self.myArray = [NSArray arrayWith...]) and a property marked retain, it will be freed possibly as soon as the method in which you allocated it returns.

    TL;DR is to check where you’re assigning the array and make sure you’re using something like this:

    self.startingPlayers = [NSArray arrayWithObjects:@"first", @"second", nil];
    

    and not like this:

    startingPlayers = [NSArray arrayWithObjects:@"first", @"second", nil];
    

    That one’s bitten me countless times, including in the middle of a presentation right after I mentioned not to do it.

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

Sidebar

Related Questions

I'm trying to debug an application that is making a WebRequest synchronously, ie.: HttpWebRequest
I'm trying to debug and step through an Android application that segfaults. I've tried
I'm trying to debug an application and it isn't a place that's convenient to
I am trying to debug a Java application that is relying on Reflection. Right
I'm trying to debug my c# application that check MIPS syntax. But its not
I am trying to debug my application that calls some stored procedure. I don't
I have a C++ Android application that I'm trying to debug with ndk-gdb. The
I am trying to debug a web application through IIS that has a virtual
I am trying to debug an iPhone application created by a contractor that is
I am trying to debug an embedded application that uses select() to implement communication

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.