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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:02:43+00:00 2026-06-12T03:02:43+00:00

I am developing a chat application, where i have multiple view controller classes. I

  • 0

I am developing a chat application, where i have multiple view controller classes. I also have a generic class where communication is happening between server and client. This communication class never know which view controller is been accessed it, because it is been accessed by all the view controllers for different reasons. In this situation, I am in need of updating the states like ‘connection failed’, ‘internet failure’, ‘data failed’, ‘chat communication failed’ like that to all the view controllers as soon as such errors happening at the communication class. I am thinking to solve by this having a flag setting in a singleton class and access it anywhere else (or) have a protocol (which is very secured than singleton) and set the status flag in communication class, and other view controllers can implement this protocol method to know the current status.

Could someone advise me whether i’m thinking at the right angle to implement and can achieve with these approaches?

  • 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-12T03:02:44+00:00Added an answer on June 12, 2026 at 3:02 am

    Take a look at notifications, which are intended for general distribution to multiple instances exactly like this. See the docs for NSNotificationCenter.

    Notifications are not just for hardware events, as you seem to misunderstand. They are a general purpose broadcast mechanism to distribute information, just as delegation is a general purpose mechanism to allow an individual object to manage another objects behaviour.

    In other words, your communications handler should post a notification of state change, and your other controllers should all register to receive that notification, and can respond however is appropriate for them.

    Post example; put this when your file has finished loading:

        [[NSNotificationCenter defaultCenter] postNotificationName:@"PDLAssetManagerAssetFileLoaded" object:self];
    

    And in each controller that needs to update itself when loading is complete, put:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadComplete:) name:@"PDLAssetManagerAssetFileLoaded" object:nil];
    

    where loadComplete: is a method that takes the notification as an argument, and does whatever you need it to do. You can pass extra data using the userInfo dictionary, which I have ignored here. Hot tip: make the notification name string a constant; I skipped this in the interest of brevity.

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

Sidebar

Related Questions

Hi all i am developing a chat application ... i have multiple chat windows
I'm developing a small chat application between client and server. I would like to
I am developing an application in asp.net mvc where i need to have Chat
I am developing Android Application for Chat between two users as private session .
I am developing a chat application. And i want to have pop up window
I am developing a chat application.Here for chat i have used ListView . I
I have a chat application that I am developing with SignalR. In the chat
I have to develop a multiple users chat application (like msn). I don't what
I'm developing a chat application in Android and have run into a massive problem.
I'm developing a chat application in java using DatagramSocket and DatagramPacket . The data

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.