Resolved Basic data storage

Discussion in 'iOS Programming' started by MickeyT, Jun 26, 2012.

  1. MickeyT, Jun 26, 2012
    Last edited: Jan 4, 2013

    MickeyT macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
    #1
    I am a novice programmer and I find the best way to learn is to do.

    I generally conjure up an idea to act as a mini case study that I then try to figure out and write. However, most of the stuff I come up with needs some form of data storage, otherwise the "case study" runs out of steam pretty quickly.

    I would rather not delve into the detail of core data at the moment given that I am still grappling with some of the fundamental language and programming concepts.

    I have some experience of writing VBA in Excel, which is where I have developed my understanding of OOP and the best ways to structure a program. However, I have been spoilt when it comes to parking some data for use later as I have a spreadsheet in which I have been able to do that.

    I briefly started looking at ADO and talking to a database with a spreadsheet as a front end for work, but I kind of want to avoid delving into the equivalent in Objective C/Xcode (which I think is core data/SQL Lite etc) because I want to focus on the language and the OOP stuff first.

    Therefore, what is the quickest-to-understand and simplest way of storing data that I can use for the meantime whilst I am concentrating on other things? I'm thinking along the lines of being able to maybe store preferences, or if there was a way of writing the contents of an array to memory so that when I open the app again next time, I can re-populate the array upon loading and then I'm happy to go on from there storing stuff in variables/objects.

    It's just to facilitate me being able to focus on the coding and not be held back by the data storage issue.

    Thanks.
     
  2. MickeyT thread starter macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
    Store preferences with NSUserDefaults.

    If the amount of data is small ("small" being context-dependent), then some developers find that simply storing their data in NSUserDefaults suffices. This is mostly when the application is NOT document-centered. I.e., if the app has the concept of separate savable documents, don't store them in NSUserDefaults.
     
  4. MickeyT thread starter macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
    #5
    Hello again

    I have been making some progress using property lists, but I'm struggling a little bit because I can't find the plist file I have created. In fact, I can't even find the Library file inside my user folder. I think the writing of the plist file has worked because when I step through my code it never logs an error. I just simply cannot see any folders on the path that I have written to.

    When hovering over the NSString object containing the path the following location appears:

    /Users/Me/Library/Application Support/iPhone Simulator/5.1/Applications/...

    and then what I understand to be a GUID for the app.

    When I go to my home folder to look for the Library folder, its not there, and nothing shows up using a search in spotlight.

    I'll be missing something I'm sure - can anyone point out what I'm doing wrong please?

    Thanks
     
  5. MickeyT thread starter macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
    #6
    Sorted this myself - its nothing to do with what I've written. Its to do with OS X Lion hiding the Library folder.

    Clicking on Go in the Finder menu bar and pressing alt reveals Library and then its easy to navigate the rest of the way to the relevant folder from there.
     

Share This Page