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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:33:56+00:00 2026-05-30T09:33:56+00:00

I tried to modify it a bit and looked at other options here and

  • 0

I tried to modify it a bit and looked at other options here and googled some stuff but nothing seems to work.

here’s what I have, like I said, It works perfectly in the simulator but not the device, witch runs iOS 5.x
I thanks for all the help.

   NSFileManager *filemgr;
   NSString *docsDir;
   NSArray *dirPaths;

   filemgr = [NSFileManager defaultManager];

   // Get the documents directory
   dirPaths = NSSearchPathForDirectoriesInDomains(
                                               NSDocumentDirectory, NSUserDomainMask, YES);

   docsDir = [dirPaths objectAtIndex:0];

  //Build the path to the data file
  datafilePath = [[NSString alloc] initWithString: [docsDir 
                                                 stringByAppendingPathComponent:  @"data.archive"]];
   //  NSString *localPath = @"Documents/data.archive";
   //  datafilePath = [NSHomeDirectory() stringByAppendingPathComponent:localPath];

  // Check if the file already exists
  if ([filemgr fileExistsAtPath: datafilePath])
  {
    NSMutableArray *dataArray;
   // NSDictionary *stuff;

    dataArray = [NSKeyedUnarchiver 
                 unarchiveObjectWithFile: datafilePath];


    for(int i=0; i< [dataArray count]; i++){
    titlestring = [dataArray objectAtIndex:i ];
    detailsstring = [dataArray objectAtIndex:++i];

   // date = [dataArray objectAtIndex:2];


        [tabledata addObject:titlestring];
    [tablesubtitles addObject:detailsstring];

    }

   }





  }

this is the saveButton action:
Like I said, I works fine in the simulator, just doesn’t do anything in the device, everything shows up blank.

if (i == 0) {

   // [userDefaults setObject:titlefield.text forKey: @"titlehomework"];
  // [userDefaults setObject:detailstextfield.text forKey:@"detailshomework"];

    NSMutableArray *contactArray;
   contactArray = [NSKeyedUnarchiver 
       unarchiveObjectWithFile: datafilePath];

   // contactArray = [[NSMutableArray alloc] init];
    [contactArray addObject:titlefield.text];
    [contactArray addObject:detailstextfield.text];

    [NSKeyedArchiver archiveRootObject: 
     contactArray toFile:datafilePath];

    // NSDictionary *stuff;



    }
  • 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-30T09:33:57+00:00Added an answer on May 30, 2026 at 9:33 am

    It’s difficult to answer the question without knowing what’s failing, but it may help you to know that very often when people get code working on the simulator but not on the device, the problem is related to file names. The file system in iOS is case sensitive, but the MacOS X file system often isn’t case sensitive. So if you’re trying to read a file with the name “data.archive” but the name of the actual file is “Data.archive”, it’ll work on the simulator but not on the device.

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

Sidebar

Related Questions

I need to modify a text file from multiple .NET processes, nothing I've tried
at work I am struggling a bit with the following situation: We have a
I have this working code f = SomeForm(request.POST) When I tried to modify it
I tried to modify a type using the following code and it gave me
I tried to code EXTJS Grid using jsp. I modify the EXTJS example to
I have a form that tries to modify a JComponent's graphics context. I use,
Tried almost everything and got no success making DefaultHttpClient() to work with expired SSL
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried following the instructions here: How to use Google app engine with my own
I'm here now because of two things. First: I need to modify a jQuery

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.