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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:04:42+00:00 2026-06-10T23:04:42+00:00

I saw an Apple sample code with a NSDictionary being initialized using @{ value:key

  • 0

I saw an Apple sample code with a NSDictionary being initialized using @{ value:key } notation. I use to initialize a constant NSDictionary using +dictionaryWithObjectsAndKeys:

My question is:

Is there any difference between the two generated NSDictionaries? Do I need to worry about memory leaking? I’m using ARC.

All I found about it is this Apple doc, but it is related to Mac, not iOS. And the notation is @{ key = value } and not @{ value:key }.

http://developer.apple.com/legacy/mac/library/documentation/LegacyTechnologies/WebObjects/WebObjects_3.1/DevGuide/WebScript/CreatingObjects.html

A second question would be: is that safe to use this to submit the app to App Store, or would it be considered “undocumented API”?

Thanks!

  • 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-10T23:04:44+00:00Added an answer on June 10, 2026 at 11:04 pm

    I use… +dictionaryWithObjectsAndKeys: … Is there any difference between the two generated NSDictionaries?

    The compiler uses +[NSDictionary dictionaryWithObjects:forKeys:count:]. So the ‘gotcha’ is that the parameters/values you use in these literal expression must not be nil. When you use +[NSDictionary dictionaryWithObjectsAndKeys:], the input stops when nil is encountered. It is an error to pass nil to a literal expression as a key or value to a literal expression. This may change your program (because semantics of dictionary creation through va_lists are different), but the stricter semantics would likely result in detecting bugs, more than anything.

    Do I need to worry about memory leaking? I’m using ARC.

    You might need an autorelease pool in some cases — that depends on the context you create it in.

    Is that safe to use this to submit the app to App Store, or would it be considered “undocumented API”?

    You will need Apple-Clang 4.0 (Xcode 4.4). It is compatible with all versions of OS X and iOS:

    http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/_index.html

    More details here: http://clang.llvm.org/docs/ObjectiveCLiterals.html

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

Sidebar

Related Questions

I saw some code on the apple website that goes like this id <NSFetchedResultsSectionInfo>
In Apple's guidelines, I saw: 2.7 Apps that download code in any way or
I saw page when I was Searching with the key word Open source http://www.opensource.apple.com/release/mac-os-x-1064/
I saw some code when studying the open source project: here . But I
I saw the following fragment of C code in a text book and it's
I saw some html that displays the results of a PHP code just by
I saw a similar question being posted here, yet it did not help me
I was going through Apple's documentation and I saw something like this (void (^)(void))
I was looking at the Apple docs for UIScrollView and saw that the constants
I was working on a simple game app using Xcode, but when I saw

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.