Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC
ADC Home > Reference Library > Reference > Internet & Web > Web Content > Publication Subscription Framework Reference

 


PSEnclosure

Framework:
/System/Library/Frameworks/PubSub.framework
Inherits from:
Declared In:
See Also:

Overview

A PSEnclosure object contains a link to an external resource such as a sound or image file associated with an entry. An enclosure is similar to an attachment in an email, but rather than include the file itself in the entry, only a link is provided. Each enclosure object is linked to a entry object.

An enclosure object provides properties for retrieving information about the enclosure, such as its URL, length, and MIME type, as well as methods to download the file linked to in the enclosure. Invoke the download: method to begin downloading the enclosure's file. To check on the status of the download, register for the PSEnclosureDownloadStateDidChangeNotification notification. It is not recommended that you subclass PSEnclosure.



Typedefs


PSEnclosureDownloadState


The length of the file in the enclosure. (read-only)

See Also:
length
downloadState
downloadProgress
downloadError
private

typedef enum { PSEnclosureDownloadIsIdle, // A download has not been requested PSEnclosureDownloadIsQueued, // A download will commence sometime in the future PSEnclosureDownloadIsActive, // A download is currently active (check downloadProgress) PSEnclosureDownloadDidFinish, // A download successfully finish PSEnclosureDownloadDidFail, // A download failed (check downloadError) PSEnclosureDownloadWasDeleted // A download finished, but another application or the user removed the result } PSEnclosureDownloadState;
Discussion

The return value is initially parsed from the length attribute of a element in Atom and the length attribute of in RSS. If this attribute does not exist in the feed, the return value is 0. The value may change after downloading begins and the true length is received from the server.

Availability
Introduced in Mac OS X v10.5.

Properties


downloadedPath


The path to the downloaded enclosure. (read-only)

@property (
    readonly) NSString * downloadedPath; 
Discussion

The method returns nil unless the download has completed.

Availability
Introduced in Mac OS X v10.5.

downloadError


The length of the file in the enclosure. (read-only)

See Also:
length
PSEnclosureDownloadState
downloadState
downloadProgress
@property (
    readonly) NSError * downloadError; 
Discussion

The return value is initially parsed from the length attribute of a element in Atom and the length attribute of in RSS. If this attribute does not exist in the feed, the return value is 0. The value may change after downloading begins and the true length is received from the server.

Availability
Introduced in Mac OS X v10.5.

downloadProgress


The length of the file in the enclosure. (read-only)

See Also:
length
PSEnclosureDownloadState
downloadState
downloadError
@property (
    readonly) double downloadProgress; 
Discussion

The return value is initially parsed from the length attribute of a element in Atom and the length attribute of in RSS. If this attribute does not exist in the feed, the return value is 0. The value may change after downloading begins and the true length is received from the server.

Availability
Introduced in Mac OS X v10.5.

downloadState


The length of the file in the enclosure. (read-only)

See Also:
length
PSEnclosureDownloadState
downloadProgress
downloadError
@property (
    readonly) PSEnclosureDownloadState downloadState; 
Discussion

The return value is initially parsed from the length attribute of a element in Atom and the length attribute of in RSS. If this attribute does not exist in the feed, the return value is 0. The value may change after downloading begins and the true length is received from the server.

Availability
Introduced in Mac OS X v10.5.

entry


The entry with which the enclosure is linked. (read-only)

@property (
    readonly) PSEntry* entry; 
Discussion

The inverse of the enclosures property of the PSEntry class. An enclosure follows a one-to-one relationship and can only be linked to a single entry.

This method 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 method.

Availability
Introduced in Mac OS X v10.5.

length


The length of the file in the enclosure. (read-only)

See Also:
PSEnclosureDownloadState
downloadState
downloadProgress
downloadError
@property (
    readonly) long long length; 
Discussion

The return value is initially parsed from the length attribute of a element in Atom and the length attribute of in RSS. If this attribute does not exist in the feed, the return value is 0. The value may change after downloading begins and the true length is received from the server.

Availability
Introduced in Mac OS X v10.5.

MIMEType


The MIME type of the enclosure. (read-only)

@property (
    readonly,
    retain) NSString * MIMEType; 
Discussion

The MIME type corresponds to the 'type' attribute of the element in Atom and to the 'type' attribute of the element in RSS.

Availability
Introduced in Mac OS X v10.5.

URL


A URL to the enclosure's location. (read-only)

@property (
    readonly,
    retain) NSURL * URL; 
Discussion

The return value corresponds to the 'href' attribute of the element in Atom and to the 'url' attribute of the element in RSS.

Availability
Introduced in Mac OS X v10.5.




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Last Updated: 2008-03-11