Search code examples
macoscookiessafaribrowser-cachebrowser-history

How to delete safari History, Cache, Cookies, Top sites, Saved state and local storage in cocoa app(Mac) in objective c


I am new in cocoa app development. I want to delete programmatically safari History, Cache, Cookies, Top sites, Saved state and local storage once I quit safari in objective c. Please help me if anyone knows.


Solution

  • You can delete safari History, Cache, Cookies, Top sites, Saved state and local storage files for all browsers by searching these files location under path ~/Library/Application Support/ and then that browser folder name.

    For Safari you will get all files under ~/Library path.

    After went to that files folder location use NSFileManager to delete files.