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

  • Home
  • SEARCH
  • 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 8213887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:16:22+00:00 2026-06-07T11:16:22+00:00

In the program I use this method to create a file in which I

  • 0

In the program I use this method to create a file in which I can save:

-(NSString*) saveFilePath{
NSString* path = [NSString stringWithFormat:@"%@%@",
                  [[NSBundle mainBundle] resourcePath],
                  @"savingfile.plist"];
return path;}

Then I used a button to initiate the process of putting the data into the file (I first put it all into an array so that it would be easier.):

- (IBAction)save
{

NSMutableArray *myArray = [[NSMutableArray alloc] init];
[myArray addObject:name.text];
[myArray addObject:position.text];
[myArray addObject:cell.text];
[myArray addObject:office.text];
[myArray addObject:company.text];
[myArray writeToFile:[self saveFilePath] atomically:YES];

}

Finally, I loaded the information back into the textfields in the – (void)viewDidAppear method.

- (void)viewDidAppear:(BOOL)animated
{
NSMutableArray* myArray = [NSMutableArray arrayWithContentsOfFile:[self saveFilePath]];
name.text = [myArray objectAtIndex:0];
position.text = [myArray objectAtIndex:1];
cell.text = [myArray objectAtIndex:2];
office.text = [myArray objectAtIndex:3];
company.text = [myArray objectAtIndex:4];
}

For some reason, on the simulator it’s working perfectly on the simulator, but not working at all when I try to run on my physical iPhone.

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

    I think you’re trying to save to a location that’s read-only on iOS. It works on the simulator because the simulator doesn’t totally replicate the sandboxing environment on the actual hardware.

    Rather than saving to the resourcesPath you should be saving your files to the Documents directory (or the cache directory, if appropriate).

    You can get a path to the documents directory as follows:

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    

    There’s more information at this question here: How to save file in resource folder of an app in Objective-c

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

Sidebar

Related Questions

use this website a lot but first time posting. My program creates a number
This program I use has it's own variables to set when you run it,
I use the Frama-C tool to generate the dependence graph of this program(main.c). #include<stdio.h>
I'm trying to compile this simple program to start learning how to use timers:
I'm trying to use my variable in all files of my program. this is
Im trying to use Date Formatters (NSDateFormatter), but I keep getting this error: Program
Here is my custom logger class, which helps me create logs file in my
I have this problem in my application: Step 1 - create an file (xml)
I'm writing a program to read data from a file, which may be in
I have program which loads an assembly using Asssembly.LoadFrom method. Some time later I

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.