Search code examples
objective-ccocoawebkitembedded-resourceresource-files

How Do I Embed Local HTML into Cocoa Binaries?


I'm using Objective C for a Cocoa application on OSX with some local HTML files that get loaded into a Webkit widget. However, a virus could easily modify those HTML files. So, I added a CRC hash to detect tampering, which shows a warning and then closes the application. However, is there a way to additionally protect the local HTML further such as compiling it into the binary of the application itself, or compiling into a single resource file? I noticed with Qt that they have a way to put the HTML into a resource file and then change the webkit URLs to load from there instead of file://. But this is Objective C in this case.


Solution

  • It's not possible from Objective C or Swift like it is from Qt. There is no HTTP URL that you can pass to the WebKit widget to pull content out of the Asset Catalog.