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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:20:15+00:00 2026-05-14T01:20:15+00:00

Sorry if the question isn’t correct, I’m very new in Objective-C. I understand why

  • 0

Sorry if the question isn’t correct, I’m very new in Objective-C.
I understand why this code throw the Warning: “warning: passing argument 1 of ‘initWithObjectsAndKeys:’ makes pointer from integer without”

NSDictionary *dictNames =
[[NSDictionary alloc] initWithObjectsAndKeys:
     3, @"",
     4, @"",
     5, @"",nil];

Keys and Values of a NSDictionary must be NSObject and not fundamental types, like the integers 3, 4 and 5. (Correct me if necessary).
But I don’t understand why this warning dissapears with the only “correct typing” of the first Key.

NSDictionary *dictNames =
    [[NSDictionary alloc] initWithObjectsAndKeys:
     [NSNumber numberWithInteger:3], @"",
     4, @"",
     5, @"",nil];

It’s because NSDictionary assumes the type of the other Keys? Is correct this manner of initialization?

  • 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-14T01:20:15+00:00Added an answer on May 14, 2026 at 1:20 am

    The prototype of the method you mentioned is

    -(id)initWithObjectsAndKeys:(id)firstObject, ...;
    

    Thus the first parameter must be an ObjC object. But the rest are passed by varargs. In C, any primitives can be passed as vararg arguments (think printf). Hence the compiler won’t issue any warnings.

    While the compiler is incapable of chekcing the types of the vararg arguments, it doesn’t mean passing non-id into the method is valid.

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

Sidebar

Related Questions

Sorry if the question isn't phrased very well but I'm new to SSAS and
Sorry, still reasonably new to Javascript here, so hope this question isn't too embarrassingly
Sorry if this question seems obvious for everyone, but I am very new to
The title to this question isn't written very well. Sorry 'bout that. I'm curious
First of all, sorry if this isn't an appropriate question for StackOverflow. I've tried
Sorry if this question is very easy, but I can't find the answer anywhere.
Sorry if this question is somewhat subjective. I am new to 'could store', 'distributed
Sorry if this question isn't clear. The short story is that we had someone
Sorry if this question isn't allowed, but of these 3 which one do you
[I'm sorry that this isn't directly a programming question. But I have recently switched

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.