How to add an URL to Safari's reading list in iOS?

丶灬走出姿态 提交于 2019-12-12 08:53:57

问题


In my UIWebView I would like to add an option to add the current page to Safari's reading list. I know this feature exists since GMail offers it when long-pressing a link, yet I can't find any info on what URL scheme to use.

Possible duplicate: How to programmatically access Safari's reading list from iOS


回答1:


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



回答2:


I believe that the action sheet you're seeing in gmail is simply a built-in of UIWebView, inaccessible to developers.



来源:https://stackoverflow.com/questions/14071270/how-to-add-an-url-to-safaris-reading-list-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!