Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Delete Web Cache / Javascript Storage

bswanbswan USMember ✭✭

I have an app that is using an http server to serve files to a Web View. The web viewers are caching image links which is causing broken images when their paths changes.

I can delete the web store on Android and UWP but I cannot figure out how to properly with iOS.





I have tried the following with no luck:

        WKWebsiteDataStore.DefaultDataStore.FetchDataRecordsOfTypes(WKWebsiteDataStore.AllWebsiteDataTypes, (NSArray records) =>
            for (nuint i = 0; i < records.Count; i++)
                var record = records.GetItem<WKWebsiteDataRecord>(i);

                    websiteDataTypes: record.DataTypes,
                    date: new[] { record },
                    completionHandler: () => { });

            for (nuint i = 0; i < records.Count; i++)
                var record = records.GetItem<WKWebsiteDataRecord>(i);

                    new[] { record }, () => { Console.Write($"deleted: {record.DisplayName}"); });


        NSUrlCache.SharedCache.DiskCapacity = 0;
        NSUrlCache.SharedCache.MemoryCapacity = 0;

Best Answer


  • NMackayNMackay GBInsider, University admin


    Thanks for sharing.

Sign In or Register to comment.