4

i use htm file for some work in program. in simulator i defined local file like this ;

    var a = dic["acil_adi"]?.asString()
    var path = NSBundle.mainBundle().pathForResource(a,
        ofType: ".htm")
    var url = NSURL(fileURLWithPath:path!)
    var request = NSURLRequest(URL:url)
    println("\(url)")

    var theWebView:WKWebView = WKWebView(frame:self.view.frame)
    theWebView.loadRequest(request)
    self.view.addSubview(theWebView)

but when i send this app to device (iPhone 5s)

error appears : file:///private/var/mobile/Containers/Bundle/Application/2E9F7BCA-D57E-4C47-8BBC-6CBF2FF2B2E1/Receteler.app/Akciger_odemi_Akut_Kalp_Yetmezligi.htm Could not create a sandbox extension for '/'

this is my htm files folders on project. i added them "add files to project" from desktop my htm file folders in project

can you help me why i take an error ?

cause of wrong import file or about bundle ? i don't know objective-c very well so if you give me advice with swift i will be very happy.

thank you

ardacankaya
  • 211
  • 1
  • 4
  • 14

1 Answers1

3

You are missing WKWebView configuration. Please add the following lines before loading your html file to fix the problem.

var theConfiguration = WKWebViewConfiguration()

theWebView = WKWebView(frame:self.view.frame, configuration: theConfiguration)