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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:52:42+00:00 2026-06-04T09:52:42+00:00

I am working on a basic hello world application that will open a txt

  • 0

I am working on a basic hello world application that will open a txt document, edit it and then finally save the document. What is the best practice for handling the edit.

I have read Apple’s documentation throughly, but when I check for the NSError **outError the method returns NO. When I comment it out
- (BOOL)writeToURL:(NSURL*)writeURL
ofType:(NSString*)type
forSaveOperation:(NSSaveOperationType)saveOp
originalContentsURL:(NSURL*)origURL
error:(NSError**)errorPtr

will write out the file.

Is there a best practice for saving a document? Is there something wrong with the below implementation? If you comment out the check for errorPtr then the modify file is written to original file.

 - (BOOL)writeToURL:(NSURL*)writeURL 
             ofType:(NSString*)type 
   forSaveOperation:(NSSaveOperationType)saveOp 
originalContentsURL:(NSURL*)origURL 
              error:(NSError**)errorPtr {

  if (errorPtr) {

    *errorPtr = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];

    return NO;
  }


    return [[[self.txtView textStorage] string] writeToURL:writeURL atomically:NO encoding:NSUTF8StringEncoding error:errorPtr];
  }
  • 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-04T09:52:43+00:00Added an answer on June 4, 2026 at 9:52 am

    Override fileWrapperOfType:error: or dataOfType:error: instead.

    And also, the error pointer is an out parameter. You should set it inside your function if needed and if it’s not null.

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

Sidebar

Related Questions

Working with a Visual Basic.NET console application that features a VERY BASIC natural language
I have the basic hello world application setup using wai, and would like to
I'm trying to get a Flask hello world application working on a Dreamhost shared
Basic summary: Working on a game that generates a 15x15 grid for the player
I'm working on a basic garden logging application which consists of gardens, plants and
I have a WCF service application with most basic settings working properly on my
Hey everyone, I'm working on a PHP application that needs to parse a .tpl
I'm simply trying to run the basic openCV hello world tutorial code, but I'm
Hello all! I'm working on a prototype that would require me being able to
I have a service, as follows: The most basic (working) CherryPy 3.1 Windows service

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.