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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:47:32+00:00 2026-06-05T16:47:32+00:00

I have some code that is supposed to return an NSString. Instead it is

  • 0

I have some code that is supposed to return an NSString. Instead it is sometimes returning an NSArrayReverseEnumerator. This causes an unrecognized selector sent to instance exception.

NSString *tFirstName = nil;
NSString *tUsername = ((NSString*)[self.userObject objectForKey:USER_NAME]).length > 0 ? [self.userObject objectForKey:USER_NAME] : [self.userObject objectForKey:USER_USERNAME];
NSRange spaceRange = [tUsername rangeOfString:@" "];
if (spaceRange.location == NSNotFound) {
    tFirstName = tUsername;
} else {
    tFirstName = [tUsername substringToIndex:spaceRange.location];
}
return tFirstName;

I’m then setting a UITextField text property to what is returned which causing an exception.

The exception is:

-[__NSArrayReverseEnumerator isEqualToString:]: unrecognized selector sent to instance 0xf1b8190

Here is the last few lines of the stack trace:

 CoreFoundation 0x381208bf __exceptionPreprocess + 163
1 libobjc.A.dylib 0x31c061e5 objc_exception_throw + 33
2 CoreFoundation 0x38123acb -[NSObject doesNotRecognizeSelector:] + 175
3 CoreFoundation 0x38122945 ___forwarding___ + 301
4 CoreFoundation 0x3807d680 _CF_forwarding_prep_0 + 48
5 UIKit 0x354dc20d -[UILabel setText:] + 45
6 Trivial 0x000873c9 -[vcGameOver viewDidLoad] (vcGameOver.m:45)
7 UIKit 0x355117ff -[UIViewController view] + 167

userObject looks like this normally, haven’t been able to reproduce in the debugger yet to see what it looks like at the time of exception:

userObject looks like this:

(PFUser *) $1 = 0x0be86fb0 <PFUser:MTsJR1DKuS> {
    answeredCorrect = "<PFRelation: 0xa847f30>";
    centsEarned = "-2353";
    centsPaidFor = 5000;
    centsUsed = 4193;
    correctAnswers = 1454;
    earnedCoinDate = "2012-06-12 19:42:44 +0000";
    eloRating = 1262;
    iq = 119;
    lastPlayedDate = "2012-06-12 19:15:46 +0000";
    locale = en;
    losses = 10;
    name = "Matt Hudson";
    status = 0;
    username = Inturbidus;
    wins = 8;
    wrongAnswers = 1157;
} 

My question is, which line in my code above could possible return an NSArrayReverseEnumerator?

  • 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-05T16:47:34+00:00Added an answer on June 5, 2026 at 4:47 pm

    You may have a dangling pointer, with some other object (in this case, the presumably private-to-Apple __NSArrayReverseEnumerator) squatting in the location in memory where your prematurely released NSString instance used to be.

    I would suggest turning on zombies (NSZombieEnabled) and seeing if you get a “message sent to deallocated instance” error message instead of the one you got.

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

Sidebar

Related Questions

I have some code that causes the box2d physics simulation to stutter forever after
I have some code that looks like this: foreach(var obj in collection) { try
I have some PHP AJAX code that is supposed to validate some parameters sent
I have some plugin code that is supposed to look up the number of
I have some code that will change the background color of a specific label
I have some code that generates Visio masters for me, and some masters have
I have some code that runs a model in a loop. Each iteration of
I have some code that shows results in a table Right now it will
I have some code that uses the SQL Server 2005 SMO objects to backup
I have some code that creates some span tags and each span has its

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.