2017-08-10 1 views
1

Ich lade HTML-Datei in Webview mit load html String-Methode. Alles funktioniert gut. In meinem Code-Benutzer wählen Sie Bild als Profil und wählen Sie Bild speichern auf Fix-Pfad und Name. Wenn der Benutzer das Bild auswählt und wenn die Web-Ansicht zu diesem Zeitpunkt neu lädt, wird das alte Bild angezeigt. Bild wurde in Verzeichnis aktualisiert, aber nicht angezeigt. Dieses Problem tritt nur in Ipad, In Iphone funktioniert gut.Webview nicht aktualisieren Bild

Haben Sie einen Vorschlag.? dann bitte

// Mein Laden-Code

webview.loadHTMLString(invoiceHTML, baseURL: NSURL(string:resumeComposer.HTMLFilePath)! as URL) 

// Image Source Update HTML String Code

imgPath = URL(fileURLWithPath: folderpathforNormal).appendingPathComponent("ProfileImg.png").path 
HTMLContent = HTMLContent?.replacingOccurrences(of: "*userimage*", with: imgPath) 

Antwort

0

klar die UIWebview Cache zuerst wie folgt vorschlagen:

//to remove cache from UIWebview 
URLCache.shared.removeAllCachedResponses() 
    if let cookies = HTTPCookieStorage.shared.cookies { 
     for cookie in cookies { 
      HTTPCookieStorage.shared.deleteCookie(cookie) 
     } 
    } 
+0

Es funktioniert hier nicht ... Problem passiert nur in ipad. Für ipad im Simulator ist es in Ordnung. Irgendein Vorschlag? –