iOS的UIActivity视图控制器:添加到阅读列表按钮?(iOS UIActivity View

2019-08-17 15:11发布

是否有能够从一个应用程序添加一个网址到iOS的Safari的阅读列表的服务。

我想有一个网址添加和一个UIWebView,但我研究,我无法找到任何东西。

这是我的工作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];
   }

Answer 1:

更新:7的iOS加入一个API来实现此目的:

#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");

目前(iOS版SDK 6.1)是没有办法的项目从第三方应用程序添加到阅读列表。

还有像一些替代的可读性 ,你可以使用。



文章来源: iOS UIActivity View Controller: Add To Reading List Button?