Mac Developer Library

Developer

PSClient Class Reference

Options
Deployment Target:

On This Page
Language:

PSClient

Inheritance


Conforms To


Import Statement


Not Applicable

Objective-C

@import PubSub;

Availability


Available in OS X v10.5 and later.
Deprecated in OS X v10.9.

A PSClient object represents a client of the API that has its own set of feeds. PSClient is the backbone of the Publication Subscription framework. To subscribe to feeds, your application must use a client object. You can then add feeds to the PubSub Database with the addFeed: and addFeedWithURL: methods. Similarly, you can unsubscribe from a feed with the removeFeed: method. It is not recommended that you subclass PSClient.

  • addFeed: - addFeed: (OS X v10.9)

    Subscribes the client to the given feed.

    Declaration

    Objective-C

    - (BOOL)addFeed:(PSFeed *)feed

    Parameters

    feed

    The existing feed object to subscribe to.

    Return Value

    YEStrue on success; NOfalse if an immediate error occurred.

    Discussion

    A feed object may only belong to one client, so if the given feed has already been added to any other client, this method will fail. Instead, create a new feed object with the same URL as the existing one or use addFeedWithURL:.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Subscribes the client to the feed at the given URL.

    Declaration

    Objective-C

    - (PSFeed *)addFeedWithURL:(NSURL *)url

    Parameters

    url

    The URL of the feed. Must be an HTTP, HTTPS, or FEED protocol.

    Return Value

    The subscribed feed, or nil if an error occurred.

    Discussion

    This method creates a subscribed feed from the given URL. If a feed with this URL is already subscribed, this method returns a feed object from the existing data in the PubSub Database.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Returns the entry with the given identifier.

    Declaration

    Objective-C

    - (PSEntry *)entryWithIdentifier:(NSString *)identifier

    Parameters

    identifier

    The unique string associated with a entry.

    Return Value

    The entry associated with the specified identifier, or nil if the identifier is not in a subscribed feed.

    Discussion

    Entry identifiers are persistent, unique, and unchangeable, so they provide a way for your application to establish a persistent reference to an entry. This method considers only entries in feeds subscribed to by this client.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Returns the feed with the specified identifier.

    Declaration

    Objective-C

    - (PSFeed *)feedWithIdentifier:(NSString *)identifier

    Parameters

    identifier

    The unique string associated with a feed.

    Return Value

    The feed associated with the specified identifier, or nil if the client isn't subscribed to the feed associated with this identifier.

    Discussion

    Feed identifiers are persistent, unique, and unchangeable, so they provide a way for your application to establish a persistent reference to an feed. This method considers only feeds subscribed to by this client.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Returns the subscribed feed with the given URL.

    Declaration

    Objective-C

    - (PSFeed *)feedWithURL:(NSURL *)url

    Parameters

    url

    The URL of the feed.

    Return Value

    The feed from the given URL.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • removeFeed: - removeFeed: (OS X v10.9)

    Unsubscribes the client from a feed.

    Declaration

    Objective-C

    - (BOOL)removeFeed:(PSFeed *)feed

    Parameters

    feed

    The feed to be removed.

    Return Value

    YEStrue if the client is unsubscribed; NOfalse if an error occurred.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Calls the delegate methods and sends the corresponding notifications that would have been called if the client had been running since the specified date.

    Declaration

    Objective-C

    - (void)sendChangesSinceDate:(NSDate *)dateLastUpdated

    Parameters

    dateLastUpdated

    The date after which you want changes sent.

    Discussion

    Some clients may choose to associate their data with various Publication Subscription instances. Since feeds and articles can change when a client isn't running, dateLastUpdated and sendChangesSinceDate: are needed to maintain a synchronized state. The typical date passed to this method is the value that was returned by the dateLastUpdated method just before the application quit.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Returns a list of the bundle identifiers for the clients that have registered with the PubSub Agent.

    Declaration

    Objective-C

    + (NSArray *)allClientBundleIdentifiers

    Return Value

    An array of string objects containing the bundle identifiers of the clients registered with the PubSub Agent.

    Discussion

    This method should be used by applications that want to inspect the subscriptions of another application or construct a set of all subscribed feeds. However, the results may not be complete, because this method does not return the bundle identifiers of private clients.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Creates the default instance for the current application.

    Declaration

    Objective-C

    + (PSClient *)applicationClient

    Return Value

    A client object for the current application.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • Creates a client for the specified bundle identifier.

    Declaration

    Objective-C

    + (PSClient *)clientForBundleIdentifier:(NSString *)bundleIdentifier

    Parameters

    bundleIdentifier

    The bundle identifier of the client you want to inspect.

    Return Value

    A client object for the specified bundle identifier.

    Discussion

    This method should be used by applications that want to inspect the subscriptions of other applications or by a suite of applications that want to use a shared subscription client. If you need to create a client for the current application, use applicationClient instead.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • signature signature (OS X v10.9) Property

    The application bundle identifier associated with the PSClient instance.

    Declaration

    Objective-C

    @property(readonly, retain) NSString *signature

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • settings settings (OS X v10.9) Property

    The feed settings of the client.

    Declaration

    Objective-C

    @property(retain) PSFeedSettings *settings

    Discussion

    If the settings have not been modified, returns the default settings.

    This property attempts to communicate with the PubSubAgent process and causes the agent to launch if it is not already running. If PubSubAgent cannot be contacted, an exception will be thrown with the name PSException. To avoid problems, you should always be prepared to catch an exception thrown by this property.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • isPrivate isPrivate (OS X v10.9) Property

    A Boolean value that indicates whether the client instance is private.

    Declaration

    Objective-C

    @property(getter=isPrivate, setter=setPrivate:) BOOL isPrivate

    Discussion

    A private PSClient instance can be accessed only by an application process whose bundle identifier matches the signature of the PSClient.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.6 and later.

    Deprecated in OS X v10.9.

  • feeds feeds (OS X v10.9) Property

    An array of all the feeds subscribed to by the client.

    Declaration

    Objective-C

    @property(readonly) NSArray *feeds

    Discussion

    The ordering of the feeds in the array is undefined.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • delegate delegate (OS X v10.9) Property

    The delegate of the client.

    Declaration

    Objective-C

    @property(assign) id delegate

    Discussion

    The delegate should implement the PSClientDelegate informal protocol.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.

  • dateLastUpdated dateLastUpdated (OS X v10.9) Property

    The date and time associated with the most recent feed-change notification delivered to the receiver's delegate.

    Declaration

    Objective-C

    @property(readonly) NSDate *dateLastUpdated

    Discussion

    If no notifications have been sent at the time this method was called, it returns the date and time that the receiver was created. Because feeds and entries can change when a client isn't running, store the value from dateLastUpdated when your application quits, and pass that value to sendChangesSinceDate: to retrieve any notifications that would have been called while your application was not running.

    Import Statement

    Objective-C

    @import PubSub;

    Availability

    Available in OS X v10.5 and later.

    Deprecated in OS X v10.9.