iOS Developer Library

Developer

NewsstandKit Framework Reference NKLibrary Class Reference

Options
Deployment Target:

On This Page
Language:

NKLibrary

An instance of the NKLibrary class represents the library of issues for a newsstand content application. More...

Inheritance


Conforms To


Import Statement


import NewsstandKit @import NewsstandKit;

Availability


Available in iOS 5.0 and later.
  • Returns the shared instance representing the newsstand content library.

    Declaration

    Swift

    class func sharedLibrary() -> NKLibrary!

    Objective-C

    + (NKLibrary *)sharedLibrary

    Return Value

    A singleton instance of the NKLibrary class or nil if the instance couldn’t be created.

    Import Statement

    import NewsstandKit

    Availability

    Available in iOS 5.0 and later.

  • Creates a newsstand issue and adds it to the content library.

    Declaration

    Swift

    func addIssueWithName(_ name: String!, date date: NSDate!) -> NKIssue!

    Objective-C

    - (NKIssue *)addIssueWithName:(NSString *)name date:(NSDate *)date

    Parameters

    name

    The name of the newsstand issue. This parameter is required and the name must be unique across all issues in the library.

    date

    The date the newsstand issue was released. This parameter is required.

    Return Value

    An instance of the NKIssue class or nil if the instance couldn’t be created.

    Discussion

    The created issue is automatically added to the newsstand content library. Issues are ordered by their release date. The release date of an issue can be a factor when Newsstand Kit must delete back issues because of low levels of available flash storage.

    This method throws an exception if the name and date parameters are nil or are otherwise not valid objects. It also throws an exception if you pass in an issue name that is used by another issue.

    Import Statement

    import NewsstandKit

    Availability

    Available in iOS 5.0 and later.

  • Accesses or sets the newsstand issue that the user is currently reading.

    Declaration

    Swift

    var currentlyReadingIssue: NKIssue!

    Objective-C

    @property(strong) NKIssue *currentlyReadingIssue

    Discussion

    When you ascertain what issue the user is currently reading, you should set this property to the corresponding NKIssue instance. Newsstand Kit takes this setting into consideration when it purges back issues because of low levels of available flash storage.

    Import Statement

    import NewsstandKit

    Availability

    Available in iOS 5.0 and later.

  • Removes the specified issue from the newsstand content library.

    Declaration

    Swift

    func removeIssue(_ issue: NKIssue!)

    Objective-C

    - (void)removeIssue:(NKIssue *)issue

    Parameters

    issue

    An instance of NKIssue representing an issue in the newsstand content library.

    Discussion

    When an issue is removed, any data at the file-system location identified by the issue’s content URL (accessed through the contentURL property of NKIssue) is deleted from disk. If you have issue content elsewhere in the application sandbox, it’s your responsibility to clean it up. Calling this method also cancels any asset downloads for that issue that are underway.

    Import Statement

    import NewsstandKit

    Availability

    Available in iOS 5.0 and later.

  • Returns an issue of the newsstand content library specified by name.

    Declaration

    Swift

    func issueWithName(_ name: String!) -> NKIssue!

    Objective-C

    - (NKIssue *)issueWithName:(NSString *)name

    Parameters

    name

    The name of an issue.

    Return Value

    An instance of NKIssue representing the issue or nil if the issue couldn’t be retrieved—for example, if an issue of that name doesn’t exist in the library.

    Import Statement

    import NewsstandKit

    Availability

    Available in iOS 5.0 and later.

  • issues issues Property

    Returns the current issues of the newsstand content library. (read-only)

    Declaration

    Swift

    var issues: [AnyObject]! { get }

    Objective-C

    @property(readonly, strong) NSArray *issues

    Discussion

    Each item in the returned array is an instance of NKIssue. If there are no issues, an empty array is returned.

    Import Statement

    import NewsstandKit

    Availability

    Available in iOS 5.0 and later.

  • The assets that are currently being downloaded for one or more issues of the newsstand content library. (read-only)

    Declaration

    Swift

    var downloadingAssets: [AnyObject]! { get }

    Objective-C

    @property(readonly, strong) NSArray *downloadingAssets

    Discussion

    When a newsstand application launches, it should enumerate the NKAssetDownload objects in the returned array, call downloadWithDelegate: on each object, and process each downloaded asset.

    Import Statement

    import NewsstandKit

    Availability

    Available in iOS 5.0 and later.