iosobjective-cmacosnsuserdefaults

Easy way to see saved NSUserDefaults?


Is there a way to see what's been saved to NSUserDefaults directly? I'd like to see if my data saved correctly.


Solution

  • You can find the pList file for your app in the simulator if you go to:

    /users/your user name/Library/Application Support/iPhone Simulator/<Sim Version>/Applications

    This directory has a bunch of GUID named directories. If you are working on a few apps there will be a few of them. So you need to find your app binary:

    find . -name foo.app
    ./1BAB4C83-8E7E-4671-AC36-6043F8A9BFA7/foo.app
    

    Then go to the Library/Preferences directory in the GUID directory. So:

    cd 1BAB4C83-8E7E-4671-AC35-6043F8A9BFA7/Library/Preferences
    

    You should find a file that looks like:

    <Bundle Identifier>.foo.pList
    

    Open this up in the pList editor and browse persisted values to your heart's content.