Add URL to Safari Reading List (iOS SafariServices framework)

iOS 7 provides an API to add a URL to Safari Reading List. SSReadinglist is the class which is part of iOS SafariServices framework provides
a method addReadingListItemWithURL:::: to add URL to safari.

List of API in iOS SafariServices Framework:

List of API in iOS Safari Services Framework

Syntax :

/*!
    @method addReadingListItemWithURL:title:previewText:error:
    @abstract Adds an item to the Reading List.
    @param URL The URL of the item.
    @param title The title string of the item, or nil.
    @param previewText A string shown as detail text for the item, or nil.
    @param error Describes the error that occured.
    @result Returns YES if the item was added, otherwise returns NO and error param is set.
    @discussion Only URLs with http:// or http:// schemes are supported by Reading List.
*/
- (BOOL)addReadingListItemWithURL:(NSURL *)URL title:(NSString *)title previewText:(NSString *)previewText error:(NSError **)error NS_AVAILABLE_IOS(7_0);

Usage:

#import <SafariServices/SafariServices.h>

SSReadingList * readList = [SSReadingList defaultReadingList];
NSError * error = [NSError new];

BOOL status =[readList addReadingListItemWithURL:[NSURL URLWithString:urlToAdd.text] title:titleToAdd.text previewText:@"Any  Preivew" error:&error];

if(status)
{
        NSLog(@"Added URL Succesfully");

}
else    NSLog(@"Failed to add URL");

 

iPhone Safari Reading List

 

 


I am a Developer. My motto: "Language is not a barrier" http://hayageek.com
All posts by Ravishanker Kusuma