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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:45:47+00:00 2026-05-20T20:45:47+00:00

Help, I’m deperate..i can’t continue my app because of this: I have setup one

  • 0

Help, I’m deperate..i can’t continue my app because of this:

I have setup one message between 2 of my cocoa objective-c clases,
the main appdelegate is messaging a view through NSNotificationCenter
the view receives indeed the notification but somehow it can’t update the controls visible on the view.. it’s like it can’t find the proper instance or something.

here’s my code:
mainapp (where the appdelegate messages my view):

helloKey = @"0";
helloString = @"mymessage";

values = [NSMutableDictionary dictionaryWithObject:helloString forKey:helloKey];
[[NSNotificationCenter defaultCenter] postNotificationName:@"NewMessageNotification" object:self userInfo:values];

the function is defined in myuiviewcontoler

- (void)NewMessageNotification:(NSNotification *)notification
{

    // key associated with string "Hello String"
    helloKey = @"0";

    // [notificaiton userInfo] returns "values"
    helloFromMain = [[notification userInfo] objectForKey:helloKey]; 
    NSLog(@"newmess=%@",helloFromMain; //this outputs mymessage , perfect right?? not quite..here's the problem
        //then if I'm trying to update something visible ..it won't do IT!!!! :( :(
     //tested with the debugger and it reaches this line...when the messaging occurs
    [self.mybutton setTitle:@"sdsdsdasd" forState:UIControlStateNormal];
        //this won't work, not it will give an error!!! 
}

So what could it be the problem? nothing that is visible can be modified programaticaly when using this, and I kid of need that..

If I do a IBAction and assign it to a button of this view and do the same :
[self.mybutton setTitle:@”sdsdsdasd” forState:UIControlStateNormal];
it will update my display without no problem… modifying the title…

So what’s the difference between the function that is called by the NSnotificationcenter and a function that belongs to the same view…

I tried to see the address of the self variable in both cases,, it results to be the same…
so ..basically uses the same pointer right?

still it doesn’t work…

I’ve put another post back a few days ago..but no-one answered
Programatically created labels and images don't show on screen

  • 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-20T20:45:47+00:00Added an answer on May 20, 2026 at 8:45 pm

    It sounds very much like your NewMessageNotification: method is not being called on the main thread; UI updates must only be done from the main thread, or things won’t work correctly.

    The usual idiom for a situation like this is something along these lines:

    - (void)NewMessageNotification:(NSNotification *)notification
    {
        if (![NSThread isMainThread]) {
            [self performSelectorOnMainThread:@selector(NewMessageNotification:) withObject:notification waitUntilDone:NO];
            return;
        }
    
        // Existing code goes here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Help! I have a clickonce app built and published using .Net 2.0. This app
Help for this specific server side php code I don't have any knowledge of
Help with this criteria ? Users can be able to add as many Names
HELP! I just setup a virtual host for two sites that have a lot
Help me, please, solve one problem. I have project, which uses Nhibernate and Fluent
Help, I have this class var jMath = { pi2: Math.PI, foo: function() {
Help me translate this into proper NHibernate... I have an Oracle database with 2
help rails 3 came out yesterday, we have a fully functional rails 2.3.8 app,
Help, I can't function without Resharper . All of a sudden my Alt +
Help, Im really sick of using this lots of nbsps in my results page.

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.