Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS UIActivity View Controller: Add To Reading List Button?

Is there a service to be able to add a URL to the iOS Safari's Reading List from in a app.

I would have a url to add and a UIWebView,but I have researched and I can't find anything.

Here is my working UIActivityViewController.

 -(IBAction)actionButton:(id)sender;{
    NSLog(@"shareButton pressed");
    NSURL *URL = [NSURL URLWithString:self.feedItem[@"url"]];//this is your text string

    NSArray *activityItems = @[URL];
    ARChromeActivity *chromeActivity = [[ARChromeActivity alloc] init];

    TUSafariActivity *TUSafari = [[TUSafariActivity alloc] init];
    MLCruxActivity *cruxActivity = [[MLCruxActivity alloc] init];

    NSArray *applicationActivities = [NSArray arrayWithObjects:TUSafari,chromeActivity,cruxActivity, nil];
    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities: applicationActivities];
    activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];

    activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact];
    [self presentViewController:activityVC animated:TRUE completion:nil];
   }
like image 773
Steve Avatar asked Mar 15 '13 17:03

Steve


1 Answers

UPDATE: iOS 7 added an API to accomplish this:

#import <SafariServices/SafariServices.h>

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

BOOL status =[readList addReadingListItemWithURL:[NSURL URLWithString:urlToAdd] title:titleToAdd previewText:previewText error:&error];

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

}
else    NSLog(@"Error");

Currently (iOS SDK 6.1) there is no way to add a item to the Reading List from a third party app.

There are some alternatives like Readability you could use.

like image 54
Leon Lucardie Avatar answered Sep 24 '22 18:09

Leon Lucardie