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

  • Home
  • SEARCH
  • 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 8103055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:24:54+00:00 2026-06-05T23:24:54+00:00

Hi here is the code in question and the issues that i am getting,

  • 0

Hi here is the code in question and the issues that i am getting,
it will compile but has warning attached which i have highlighted.

-(void)viewdidloader
{   
highscore = [[[NSUserDefaults standardUserDefaults] objectForKey:@"HIGHSCORE"]integerValue];
}

(void) differnt void
if (score>=highscore) 
    {
    highscore = score;

//ISSUES START ON THIS LINE

    [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:highscore forKey:@"HIGHSCORE"]];
    highscorelabel.text = [NSString stringWithFormat:@"%i",highscore ];

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"NEW HIGH SCORE" message:[NSString stringWithFormat: @"Well done you got a new high score          Level : %d and scored %i points" ,fred,score ] delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
            [alert show];
            [alert release];
        }


        else 
        {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"You Lose" message:[NSString stringWithFormat: @"Unlucky you only made it to          Level : %d and scored %i points" ,fred,score ] delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
        [alert show];
        [alert release];
        }


Issues

NSNumber may not respond to +number:forkey
(message without a matching method signature will be assumed to return "ID" and accept '' as an argument)
NSUserdefaukts may not respond to -setobject 
  • 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-05T23:24:55+00:00Added an answer on June 5, 2026 at 11:24 pm

    Your problem is here:

    [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:highscore forKey:@"HIGHSCORE"]];
    

    there is no method signature for NSNumber that also takes a forKey argument, you are missing a bracket to close NSNumber numberwithint, change to this to fix the issue:

    [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:highscore] forKey:@"HIGHSCORE"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my question is that I have made multimap.Here is the partial code. if(binary_search(final.begin() ,
Here is my code (well, some of it). The question I have is, can
I have -- what I think -- is a simple question. Here's my code:
Really basic question here: I've seen a bunch of CoreAudio code that uses memset
Really simple question here but bugging me for long enough to ask. Code looks
Quick question, What have I done wrong here. The purpose of this code is
Here is the code in question: import wx class MyFrame(wx.Frame): This is MyFrame. It
Here's some code (full program follows later in the question): template <typename T> T
Yesterday I posted a question here ( FxCop and Code Analysis Rules ) about
Here's part of my code for a jQuery word counter. My question is: how

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.