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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:22:56+00:00 2026-05-26T07:22:56+00:00

I have a little problem with my first document based application. Is very simple:

  • 0

I have a little problem with my first document based application. Is very simple:
on myDocument.m I make some method

- (IBAction)salva:(id)sender {

    [array addObject:@"Hello"];

    [nomeLabel setStringValue:@"ciao"];

    NSLog(@"%@",[array objectAtIndex:0]);

}

this for save a value on my array

- (BOOL) writeToURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError **)outError {
    return [array writeToURL:url atomically:YES];
}

this for save the array on a file

- (void) imposta {

    [nomeLabel setStringValue:[array objectAtIndex:0]];

    NSLog(@"Ciao");

}

with this method I set the content of a label with the content of array

- (BOOL) readFromURL:(NSURL *)url ofType:(NSString *)type error:(NSError **)outError{

    [ array release];

    array = [[NSMutableArray alloc] initWithContentsOfURL:url];

    NSLog(@"%@",[array objectAtIndex:0]);

    [self imposta];

    return YES;
}

this for load the file.
The problem is that I can’t set the label with the content of loaded array. The array wes loaded because with an NSLog I see the correct value, the problem is that I can’t put it on th

  • 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-26T07:22:56+00:00Added an answer on May 26, 2026 at 7:22 am

    When opening a document for the first time, -readFromURL:ofType:error: is called before the window controllers are instantiated. That means your nameLabel connection is probably nil. You should update in -awakeFromNib or -windowControllerDidLoadNib: at the very earliest.

    But really, NSDocument is a model object and therefore shouldn’t be connected directly to a view object anyway. The document should just be storing its data, and the window controller should be responsible for updating the view.

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

Sidebar

Related Questions

I have a little problem with a simple vbScript. The script has to run
I have a little problem with some jquery and http://www.mikage.to/jquery/jquery_history_noc.html The function works great,
I have a little problem. I had some JComboBox to a JDialog but they
I have a little problem with MVVM. Let me first sketch my problem. I
First, a little background: We have an intranet site based on WSS 3.0 that
This is my first post, so first hallo all. I have a little problem
My problem is a little bit complex. I have the following code: $(document).ready(function() {
I have a little problem when I try to run my Android application. The
I have a little problem. At my application Im always building two linked combobox
i have little problem with boost::asio library. My app receive and process data asynchronously,

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.