Skip to content

Instantly share code, notes, and snippets.

@wcoder
Created October 4, 2020 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wcoder/940a89ec7239c395ebf5f38c47061dfd to your computer and use it in GitHub Desktop.
Save wcoder/940a89ec7239c395ebf5f38c47061dfd to your computer and use it in GitHub Desktop.
public static void RemoveFacebookCookies()
{
var websiteDataTypes = WKWebsiteDataStore.AllWebsiteDataTypes;
WKWebsiteDataStore.DefaultDataStore.FetchDataRecordsOfTypes(websiteDataTypes, (NSArray records) =>
{
for (nuint i = 0; i < records.Count; i++)
{
var record = records.GetItem<WKWebsiteDataRecord>(i);
if (record.DisplayName.Contains("facebook"))
{
WKWebsiteDataStore.DefaultDataStore.RemoveDataOfTypes(
record.DataTypes,
new[] { record },
() =>
{
Debug.WriteLine($"deleted: {record.DisplayName}");
});
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment