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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:57:29+00:00 2026-06-13T19:57:29+00:00

The private AppSupport framework on iOS has a class called CPDistributedNotificationCenter which appears to

  • 0

The private AppSupport framework on iOS has a class called CPDistributedNotificationCenter which appears to support a subset of the functionality provided by NSDistributedNotificationCenter on OS X.

I’m attempting to use this class to post notifications from a background daemon such that multiple clients in other processes can receive these notifications and act on them. I realize there are other options, including CPDistributedMessagingCenter or CFMessagePort, low level mach ports or even darwin’s notify_post. I’d prefer it if the daemon had no knowledge of the clients however, and I’d like to be able to pass data along with the notification, and notify_post does not allow this.

Currently, this is what I am doing in the daemon:

CPDistributedNotificationCenter* center;
center = [CPDistributedNotificationCenter centerNamed:@"com.yfrancis.notiftest"];
[center runServer];
[center postNotificationName:@"hello"];

And in the client:

CPDistributedNotificationCenter* center;
center = [CPDistributedNotificationCenter centerNamed:@"com.yfrancis.notiftest"];
[center startDeliveringNotificationsToMainThread];

NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc addObserver:[Listener new] 
       selector:@selector(gotNotification:)
           name:@"hello"
         object:nil];

where Listener is a simple class that implements a single method gotNotification:

Unfortunately, the client never receives the ‘hello’ notification. If I replace the name argument in the addObserver call with nil I can see every notification delivered to the client’s notification center, but ‘hello’ is not one of them.

I got the inspiration for my code by looking at a disassembly of SpringBoard and CPDistributedNotificationCenter. Notifications appear to be delivered via CPDistributedNotificationCenter‘s deliverNotification:userInfo: which acts as a shim for NSNotificationCenter‘s postNotificationName:object:userInfo:.

What am I missing here?

  • 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-13T19:57:30+00:00Added an answer on June 13, 2026 at 7:57 pm

    Figured it out. Your daemon has to wait for a notification indicating that a client has started listening, before sending out your notification. There is no backlog, even if the daemon server runs before the client, there is a registration delay. You can’t simply start your server and immediately post notifications to listeners. The following works for me:

    In the server init:

    self.center = [CPDistributedNotificationCenter centerNamed:@"com.yfrancis.notiftest"];
    [self.center runServer];
    
    // requires a runloop
    NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
    [nc addObserver:self
           selector:@selector(clientEvent:)
               name:@"CPDistributedNotificationCenterClientDidStartListeningNotification"
             object:self.center];
    

    And make sure to implement the following method in the server:

    - (void)clientEvent:(NSNotification*)notification
    {
        // you can now send notifications to the client that caused this event
        // and any other clients that were registered previously
        [self.center postNotificationName:@"hello!"];
    {
    

    I’ve documented this API on the iPhoneDevWiki

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

Sidebar

Related Questions

private void setFPAlarm() { Intent intent = new Intent(this, FPService.class); PendingIntent pi = PendingIntent.getService(this,
private Node back isn't used yet, and enqueue (which was push) and dequeue (which
private static class RunningMutex {} private static class ObserveMutex {} private static volatile RunningMutex
private void setDefaultResponsePageIfNecessary() { if(!continueToOriginalDestination()) { if(session.getRoles().equals(ROLE_ADMIN)){ setResponsePage(SearchForCapacity.class); System.out.println(Role for Admin: + session.getRoles()); }
private class DownloadLargeFileTask extends AsyncTask<Void, Void, Void> { private final ProgressDialog dialog; public DownloadLargeFileTask(ProgressDialog
private final List<KeyListener> keyListeners= new CopyOnWriteArrayList<KeyListener>(); public void addKeyListener(KeyListener keyListener){ keyListeners.add(keyListener); } In the
private String setDate(int day) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.DATE, + day);
private int Index(String[] match,String keyword){ int m=0; keyword=keyword+1; match[m]=match[m]+1; System.out.println(match:+match[m]); System.out.println(keyword:+keyword); System.out.println(match[m].equals(keyword)); while(!(match[m].equals()) &&
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i <
private TextBox txtBoxDragPoint = new TextBox(); private void rtbLogicCode_MouseDown(object sender, MouseEventArgs e) { if

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.