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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:13:42+00:00 2026-05-16T16:13:42+00:00

As all who usually ask such questions I’m newbie in iPhone SDK programming and

  • 0

As all who usually ask such questions I’m newbie in iPhone SDK programming and I’ve spend realy a lot of time to find the solution by my self.
So, I need to save a lot of app data of diff datatypes (bool,string,int,float,double,int arrays,double arrays and arrays of pointers) to file. There’re many forms with fields, app settings etc. All that I need to save either user quit the app, or it was terminated unexpectedly. User could work with as much forms with fields, as it’s possible. File is needed to open project with all filled forms and app sets on other device.
My trouble is that I couldn’t find in what way I should wrilte all that data to file. I tried two diff ways. 1st: fill array with form’s data, fill NSMutableArray with such arrays for every form. But for NSMutableArray there’s a method (void)addObject:(id)anObject, and I didn’t find how to get that (id)anObject from every array(or anything else) to add items.
The 2nd I’ve tried to use: NSMutableData. The same troubles: to fill with my data I need to convert them to Data ((void)appendData:(NSData *)otherData). In both cases objecs of that classes couldn’t be filled correctly with my data. And I can’t save it to file.
Maybe there’s some better solution? Will be very apreciative for any help.

  • 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-16T16:13:43+00:00Added an answer on May 16, 2026 at 4:13 pm

    NSNumber is usually the way to go for basic stuff (integers, bools, and doubles/floats/etc). For example:

    NSNumber *aBool = [NSNumber numberWithBool:YES];
    NSNumber *aFloat = [NSNumber numberWithFloat:1.0f];
    
    NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
    [settings setValue:aBool forKey:@"some_key"];
    

    The strings you can just add to NSUserDefaults because they are already objects (that conform to NSCoder, I believe), and for the NSArrays, just use the writeToFile: method:

    NSArray *someArray = [NSArray arrayWithObjects:@"foo",@"bar",@"etc",nil];
    [someArray writeToFile:@"filename" atomically:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm the type of person who usually learns by doing. I have an idea
I've been evaluating various smart pointer implementations (wow, there are a LOT out there)
For my SQL queries, I usually do the following for SELECT statements: SELECT ...
How do you usually go about separating your codebase and associated unit tests ?
I wouldn't usually bother to obfuscate a web application DLL but right now I
First of all, for the sake of clarity: the question is addressed to those
For those who still have lots of legacy code as I do in .NET
Okay this is frustrating me to no end. I recently coded a page in
I’ve been developing solutions with databases for more than 11 years now, and it
I looked for a way to scan database for a specific table. For example

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.