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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:38:49+00:00 2026-05-27T08:38:49+00:00

I defined a NSArray in a header file like this: @property (nonatomic, retain) NSArray

  • 0

I defined a NSArray in a header file like this:

@property (nonatomic, retain) NSArray *ages;

In my implementation I want to set this variable like this:

ages = [self setAges:[ageValues allKeys]];

‘ageValues’ is a NSDictionary. So what I do is just setting the array of keys to my self-defíned array. Strange enough, I get the following error message:

Asssigning to ‘NS Array *’ from incompatible type ‘void’

But where can I find something void here? In my opionion I am just setting another array ([ageValues allKeys) to my own array and I can’t find anything void???

  • 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-27T08:38:50+00:00Added an answer on May 27, 2026 at 8:38 am

    The setAges: method is a method that returns void, in other words: it returns nothing (not even nil or something; it literally is not returning anything). Now you cannot assign “nothing” to a variable.

    That being said, your code wants to do the same thing twice. All you want to do is simply:

    self.ages = [ageValues allKeys];
    

    or:

    [self setAges:[ageValues allKeys]];
    

    They do exactly the same, but use different syntax (the compiler transforms the first into the second).

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

Sidebar

Related Questions

Here's my try: H file: @interface Strings : NSArray @end M file: @implementation Strings
I have a selectedArray defined as a property in my file that holds which
I have a simple protocol with a property: @protocol StopsSource <NSObject> @property (retain,readonly) NSArray
I have defined a property in application delegate.h and synthesized it in delegate.m file
I want to call a function in applicationDidEnterBackground this function is defined in other
I have an NSArray which holds Foo objects defined like so: @interface Foo :
I defined a record named log . I want to create an mnesia table
I defined a global variable that is called from other view and it is
I defined a Window in WPF, into this one I put a stack panel
why defined extension method with UrlHelper don't added in Url. EXTENSIONMETHOD when i want

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.