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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:17:25+00:00 2026-06-15T13:17:25+00:00

My app goes to a viewcontroller, makes two automatic server requests, makes the connection,

  • 0

My app goes to a viewcontroller, makes two automatic server requests, makes the connection, retrieves the data and correctly displays it, and is done. The user clicks a “likes” button and two more server requests are made – successfully. Displays are correct. Should be done. Then it crashes, with the error:

[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance

I’m using the very handy SimplePost class (by Nicolas Goles). Here are my requests, which are both called in viewDidLoad:

- (void) setScore {
    Profile *newPf = [[Profile alloc] initID:thisUser profil:@"na" scor:score];
    NSMutableURLRequest *reqPost = [SimplePost urlencodedRequestWithURL:[NSURL URLWithString:kMyProfileURL] andDataDictionary:[newPf toDictPf]];
    (void) [[NSURLConnection alloc] initWithRequest:reqPost delegate:self];
}
- (void) saveHist {
    History *newH = [[History alloc] initHistID:thisUser hQid:thisQstn hPts:score hLiked:NO];
    NSMutableURLRequest *reqHpost = [SimplePost urlencodedRequestWithURL:[NSURL URLWithString:kMyHistURL] andDataDictionary:[newH toDictH]];
    (void) [[NSURLConnection alloc] initWithRequest:reqHpost delegate:self];
}

The only “new” thing with my custom classes (Profile and History) is the BOOL for hLiked, but it’s “working” – the database is updating correctly.
Then, the user can click a “Likes” button (+ or -). Here are the other requests:

- (IBAction)likeClick:(id)sender {
    double stepperValue = _likeStepper.value;
    _likesLbl.text = [NSString stringWithFormat:@"%.f", stepperValue];
    [self updateLikes];
    [self updateHist];
}
- (void) updateLikes {
    //  update the question with the new "liked" score
    NSInteger likesN = [_likesLbl.text integerValue];
    Questn *qInfo = [[Questn alloc] initQwID:thisQstn askID:0 wCat:@"na" wSit:@"na" wAns1:@"na" wPts1:0 wAns2:@"na" wPts2:0 wAns3:@"na" wPts3:0 wAns4:@"na" wPts4:0 wJust:@"na" wLikes:likesN ];
    NSMutableURLRequest *reqPost = [SimplePost urlencodedRequestWithURL:[NSURL URLWithString:kLikesURL] andDataDictionary:[qInfo toDictQ]];
    (void) [[NSURLConnection alloc] initWithRequest:reqPost delegate:self];
}
- (void) updateHist {
    History *newH = [[History alloc] initHistID:thisUser hQid:thisQstn hPts:98989 hLiked:YES];
    NSMutableURLRequest *reqHpost = [SimplePost urlencodedRequestWithURL:[NSURL URLWithString:kHistURL] andDataDictionary:[newH toDictH]];
    (void) [[NSURLConnection alloc] initWithRequest:reqHpost delegate:self];
}

Messy, right? Here’s my connection code:

//  connection to URL finished with Plist-formatted user data array returned from PHP
- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    NSDictionary *array = (NSDictionary *)[NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:0 errorDescription:nil];
    BOOL keyLikeExists = [array objectForKey:@"likes"] != nil;
    if( keyLikeExists ) {
        _likesLbl.text = [array objectForKey:@"likes"];
    }
}
- (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    NSLog(@"Connection did fail." );
}

It all does a good job, and then a couple of seconds later it crashes with that “unrecognized selector” error mentioned above, like there’s still some URL activity happening. There shouldn’t be.

Anybody seen this kind of thing before? Many thanks for any help!

  • 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-15T13:17:26+00:00Added an answer on June 15, 2026 at 1:17 pm

    Somewhere in your code there’s a call to the method isEqualToString:. The thing that’s being sent that message is a NSNumber object rather than a string. Either there’s a logic problem concerning the object type or there’s a memory problem where a string was over-released and its memory is being re-used to hold a number.

    Without seeing the context for the call, it’s hard to guess.

    If you break on the exception, the stack trace should tell you where in the code it’s failing.

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

Sidebar

Related Questions

I've got the Silverlight app with 4 pages(wizard). Usually user goes throught these 4
I'm writing a bug reporter for my app. When something goes wrong, the user
Alright, here goes. I'm making a very basic app, and I want the user
I'm using Apple Document to create an app.I succeed in connection to the server,
well the calculation in my app goes like this.. have a edittext box where
I will try to explain a simple app scenario: My app goes right to
I've got a Perl based FastCGI app that rarely goes down. However, when it
I have a control that goes inactive under some conditions in my iPhone app.
I have an game app which occasionally plays sounds. When the phone goes into
I have an iOS app and I want to make it accessible. Everything goes

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.