Access safari bookmarks in macOS Mojave programmatically

人走茶凉 提交于 2019-12-08 04:12:58

问题


Since upgraded to macOS Mojave, I find there are permission restrictions to user from accessing ~/Library/Safari/Bookmarks.plist. So is there an alternative way to do it programmatically? Is there a SafariKit or something I can use to import bookmarks to my own program? I tried to search online, but no one mentions anything about it. If you guys know, please help me. Thank you


回答1:


You cannot access ~/Library/Safari/Bookmarks.plist anymore because of the stricter security rules in Mojave.

I don't think there's an API to do this specific action yet, so the solution for now is to add the application yourself to System Preferences > Security > Confidentiality > Disk access.

For example if you add Terminal.app to this Confidentiality subgroup, this will grant access to the whole disk to all commands executed in Terminal, inluding using cat/vim/... to access ~/Library/Safari/Bookmarks.plist.



来源:https://stackoverflow.com/questions/52657293/access-safari-bookmarks-in-macos-mojave-programmatically

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