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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:53:56+00:00 2026-05-16T02:53:56+00:00

I am developing an iPhone app and are using xCode to do Build and

  • 0

I am developing an iPhone app and are using xCode to do “Build and analyze”. I get the message “Receiver in expresseion is a garbage value” pointing to the line of the return-row in my bode below:

-(UIColor*)getLevelColor{
UIColor* tempCol;

if (level==4) {
    tempCol= [[UIColor alloc] initWithRed:0.39f green:0.82f blue:0.32f alpha:1.0f];
}else if (level==5) {
    tempCol= [[UIColor alloc] initWithRed:0.61f green:0.68f blue:0.83f alpha:1.0f];
}else if (level==6) {
    tempCol= [[UIColor alloc] initWithRed:0.90f green:0.68f blue:0.99f alpha:1.0f];
}else if (level==7) {
    tempCol= [[UIColor alloc] initWithRed:0.68f green:0.97f blue:0.99f alpha:1.0f];
}

return [tempCol autorelease];
}

How come I get this and how do I fix it so I don’t get the message?

Thanks in advance!

Niklas

  • 1 1 Answer
  • 1 View
  • 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-16T02:53:57+00:00Added an answer on May 16, 2026 at 2:53 am

    I’d guess that the compiler sees that there is a code path which returns an uninitialized value and gives you the news: tempCol is an uninitialized value unless level is anything else than 4,5,6 or 7. If you are sure that level will never be anything than 4,5,6 or 7 then add a else { return 0; } to the end of your if-ladder.

    PS: You should use a switch(){} statement if you have to compare against a series of constant values, this is often faster and easier to maintain (IMHO). Alternatively, you could place the RGBA values in an array which you index with level.

    (Disclaimer: I don’t do Objective-C. Nobody should do it)

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

Sidebar

Related Questions

I'm developing an iPhone app with latest SDK and XCode 4.2 I'm using this
I am currently developing an iPhone app using Apache Cordova (phonegap) and xcode to
I am developing an app for iPhone using iOS5 and xcode 4.2. The scenario
I am developing an iphone app using xcode. I would like to automate the
I'm developing an iphone app using PhoneGap 1.2.0 with Snow Leopard, Xcode 4.2 &
Ok, I am developing an iphone app in xcode using cordova/phonegap. For one of
Am looking into developing an iPhone native app using Titanium Developer Since this is
I've been developing my first iPhone app part-time and would like to start using
I've been developing an iPhone using xcode 3.2.2 and using 3.O as my base
Using the Settings.app on the iPhone isn't that hard. In fact Xcode does the

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.