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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:23:11+00:00 2026-05-20T11:23:11+00:00

I have set up a preference using multi_preference in my Root.plist in my Settings.bundle

  • 0

I have set up a preference using multi_preference in my Root.plist in my Settings.bundle as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>StringsTable</key>
    <string>Root</string>
    <key>PreferenceSpecifiers</key>
    <array>
        <dict>
            <key>Type</key>
            <string>PSMultiValueSpecifier</string>
            <key>Key</key>
            <string>multi_preference</string>
            <key>DefaultValue</key>
            <string>Show First Page</string>
            <key>Title</key>
            <string>My Option</string>
            <key>Identifier</key>
            <string>myOption</string>
            <key>Titles</key>
            <array>
                <string>Option 1</string>
                <string>Option 2</string>
            </array>
            <key>Values</key>
            <array>
                <string>Option 1</string>
                <string>Option 2</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

When I try to get the value from the list using the following code:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *option = [defaults arrayForKey:@"myOption"];

I always get nil returned.

I am using the simulator and I have set initial values in my applications settings.

Anybody got any ideas what I have missed out?

Thanks

iphaaw

  • 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-20T11:23:11+00:00Added an answer on May 20, 2026 at 11:23 am

    Sorry for my previous answer, I misunderstood the question. Let’s try this again.

    Looking at the documentation for PSMultiValueSpecifier, the key for NSUserPreferences is stored in the “Key” key in the plist, not the “Identifier” key. So in this case, [defaults arrayForKey:@"multi_preference"] should get you your value. Or you could change it like this and it should work with “myOption”:

        <dict>
            <key>Type</key>
            <string>PSMultiValueSpecifier</string>
            <key>Key</key>
            <string>myOption</string>
            <key>DefaultValue</key>
            <string>Option 1<string>
            <key>Title</key>
            <string>My Option</string>
            <key>Titles</key>
            <array>
                <string>Text for Option 1</string>
                <string>Text for Option 2</string>
            </array>
            <key>Values</key>
            <array>
                <string>Option 1</string>
                <string>Option 2</string>
            </array>
        </dict>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set the two buttons in preference.xml file. I want to go to
My project is ARC enabled (the build settings have Objective-C Reference Counting set to
I have set up upload_max_filesize and post_max_size to 32Mb in php.ini. I am using
I have been trying to detect the browser language preference using JavaScript. If I
The Preference class allows for an Intent to be set, to have a preference
I have a multi-step form that I set up in rails 3 using this
I'm using PreferenceActivity to set some preferences about another BroadcastReciever that i have. While
I have a couple of CheckBoxPreferences set up, my preference class extends PreferenceActivity and
I using umbraco to create a multi territory website so I have nodes set
I have parent/child relationship set up via Node Reference. A Child record can have

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.