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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:10:07+00:00 2026-06-14T08:10:07+00:00

Save Mechanics I have used: NSMutableData *data = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver =

  • 0

Save Mechanics I have used:

    NSMutableData *data = [[NSMutableData alloc] init];
    NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
    [archiver encodeObject:self forKey:@"Save"];
    [archiver finishEncoding];
    [data writeToFile:filePath atomically:YES];
    [archiver release];
    [data release];

I have used

[[NSFileManager defaultManager] fileExistsAtPath:savePath];

[[NSFileManager defaultManager] contentsOfDirectoryAtPath:[SynchronizedData createPath] error:&error]

to check the existences of my file. They confirm the file exist.

However I cannot load the file with the same directory path

    //NSData *encodedData = [[NSFileManager defaultManager] contentsAtPath:[SynchronizedData createPath]];

    NSData *encodedData = [[[NSData alloc] initWithContentsOfFile:tempFilePath] autorelease];

    if (encodedData == nil) {
        NSLog(@"Save cannot open while loading!");
        return nil;
    }

The above encodedData, both returned nil. (autorelease is not the problem, i’ve checked)

Any ideas what’s wrong?

I found similar case in previous thread, I tried retain once more my tempFilePath, it doesn’t matter, the problem still exist.


I have done the save in a more simpler mechanism than the above one.

The problem remained unsolved for getting the NSData from directory. Maybe due to Read Permission mentioned by @paxdiablo.

Thus I use “Documents” folder instead of “Library”. The NSData open has no error.

  • 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-14T08:10:08+00:00Added an answer on June 14, 2026 at 8:10 am

    A file can exist but still not be readable. You should probably start by checking the permissions on that file.

    Also, use the initWithContentsOfFile:options:error: variant to get an error back – that should hopefully tell you if there’s a problem.

    And, based on your comment that you’re seeing:

    Cocoa error 257

    it appears the permissions are the problem. If you look at the Foundation constants, you’ll see:

    NSFileReadNoPermissionError = 257

    meaning that you have no permission to read that file.

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

Sidebar

Related Questions

I have some mechanics to measure method execution time. Simply at start of method
I need to have some mechanism to backup and restore some data files from
here is code that I have: agent = Mechanize.new page = agent.get 'http://google.com' page.save
I have some configuration I want to save it in my Android application and
In Fusion charts 3.0 they have option to save the graph as PNG. But
e.g. I have a model Student: class Student < ActiveRecord::Base def self.do_something ss=Student.find_by_sex m
I have a django form that first validates its data through calling form.is_valid(). If
I have following script which processes emails and save them to csv file. there
I have a requirement to save an image file in various formats. The list
I have a SOAP web service and I'm trying to figure how to save/log

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.