How to programmatically access Safari's readin

2019-04-19 03:34发布

问题:

Is it possible to access Safari's "Reading List" programmatically from iOS? I know it is possible to do it from a Mac as described here:

https://discussions.apple.com/thread/3238741?start=0&tstart=0

Thanks, gb

回答1:

iOS 7 finally added an API to accomplish this:

#import <SafariServices/SafariServices.h>

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

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

if (status) {
    NSLog(@"Added URL");
}
else {
    NSLog(@"Error: %@", [error localizedDescription]);
}


回答2:

It's not possible. There is no API for accessing the reading list. Moreover, it doesn't help if you find out the plist file's location, because of the sandbox environment it can't be accessed.



标签: ios safari