I'm trying to use PDFJs in a WebView to load a locally stored file in the apps data directory. It works fine on my iOS simulator, however, once I put the build into TestFlight and test on a real device, PDFJs loads and throws exception missing_file_error.
I have added the following to my MauiProgram.cs:
#if IOS || MACCATALYST
if (handler.PlatformView is WKWebView wkWebView)
{
wkWebView.Configuration.Preferences.SetValueForKey(Foundation.NSObject.FromObject(true), new NSString("allowFileAccessFromFileURLs"));
wkWebView.Configuration.Preferences.SetValueForKey(Foundation.NSObject.FromObject(false), new NSString("secureContextChecksEnabled"));
wkWebView.Configuration.Preferences.SetValueForKey(Foundation.NSObject.FromObject(true), new NSString("fileSystemAccessEnabled"));
wkWebView.Configuration.Preferences.SetValueForKey(Foundation.NSObject.FromObject(true), new NSString("storageAPIEnabled"));
}
#endif
The following to my Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSAllowsLocalNetworking</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>