Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14561] iOS : Getting Error in logs while loading a pdf in webView

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2013-10-18T21:11:23.000+0000
Affected Version/sRelease 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsios, pdf, webview
ReporterMeenakshi Pathak
AssigneeIngo Muschenetz
Created2013-07-16T07:15:18.000+0000
Updated2014-06-19T12:43:03.000+0000

Description

When we try to load a pdf in a webView, we always get an error log :
[ERROR] Couldn't determine the proper encoding. Make sure this file: Test-1.pdf is UTF-8 encoded.
Steps to Reproduce: 1. Create a new project in Titanium. 2. Please find attached pdf.Replace the app.js code with the following code:
Titanium.UI.setBackgroundColor('#000');
 
var Window = Titanium.UI.createWindow({  
    backgroundColor:'#fff'
});

var webview = Titanium.UI.createWebView({top:0,left:0,height:'100%',width:'100%',url:'Test-1.pdf'});

Window.add(webview);

Window.open();
3. Run the project for iOS device. 4. Go to the project's build folder and launch .xcodeproj file. 5. Run the project and see the logs. Note : We just get the error logs otherwise the pdf loads in a webview perfectly fine.Tested with setting data property also but got the same result.

Attachments

FileDateSize
Test-1.pdf2013-07-16T07:15:18.000+000013873

Comments

  1. Blain Hamon 2013-07-30

    Okay, this is due to TiUIWebView.m:533. Namely, we check any local file to see if they're HTML that needs injection. It fails gracefully, which is why the PDF loaded, but we should have a blacklist of file types to not inject.
  2. Wilson Luu 2013-10-18

    Closing ticket as duplicate of TIMOB-11665.

JSON Source