Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17670] iOS8: DocumentViewer not displaying PDF files

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-09-26T20:35:17.000+0000
Affected Version/sRelease 3.2.2, Release 3.2.3, Release 3.3.0, Release 3.4.0
Fix Version/sRelease 3.4.0, Release 3.5.0
ComponentsiOS
Labelsqe-automatedtest, supportTeam
ReporterMarco Cota
AssigneeChee Kiat Ng
Created2014-09-10T14:15:48.000+0000
Updated2015-01-09T17:24:08.000+0000

Description

Issue

Using DocumentViewer on iOS 8 is not rendering PDF files.

Steps to repro

1. Run test case (test.zip) 2. Click on Launch Doc button 3. On the navigation bar press the done button 4. Click on Launch PDF button

Expected result:

After clicking on Launch Doc button the .docx file is rendered in the DocumentViewer and after clicking on Launch PDF button the .pdf file is also shown in the DocumentViewer.

Actual result:

After clicking on Launch Doc button the .docx file is rendered in the DocumentViewer and after clicking on Launch PDF button the .pdf file is not being shown by the DocumentViewer.

Sample code

var win = Ti.UI.createWindow(); 
// Use a NavigationWindow to create a navigation bar for the window 
var navWin = Ti.UI.iOS.createNavigationWindow({window: win}); 

var navButton = Titanium.UI.createButton({title:'Launch'}); 
win.RightNavButton = navButton; 

var docButton = Titanium.UI.createButton({ 
title:'Launch Doc', 
height:40, 
width:200, 
top:230 
}); 
win.add(docButton); 

var pdfButton = Titanium.UI.createButton({ 
title:'Launch PDF', 
height:40, 
width:200, 
top:280 
}); 
win.add(pdfButton); 

// Create a document viewer to preview a PDF file 
docViewer = Ti.UI.iOS.createDocumentViewer(); 
// Opens the options menu and when the user clicks on 'Quick Look' 
// the document viewer launches with an animated transition 
navButton.addEventListener('click', function(){ 
	docViewer.show({view:navButton, animated: true}); 
}); 
// The document viewer immediately launches without an animation 
docButton.addEventListener('click', function(){
	docViewer.url = 'test1.docx';
	docViewer.show();
	}); 
pdfButton.addEventListener('click', function(){
	docViewer.url = 'test.pdf';
	docViewer.show();
	}); 

navWin.open();

Additional info

There are reports of this happening on native also apparently related to changes in how to call the UIDocumentInteractionController http://stackoverflow.com/questions/25430069/uidocumentinteractioncontroller-displaying-blank-pdf

Attachments

FileDateSize
test.zip2014-09-10T14:15:48.000+00003933607

Comments

  1. Ingo Muschenetz 2014-09-12

    I believe this is this line: https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIiOSDocumentViewerProxy.m#L28, but that looks similar to the corrected version in the SO post.
  2. Chee Kiat Ng 2014-09-12

    reproduced problem on iOS7 as well.
  3. Chee Kiat Ng 2014-09-12

    When trying to change url in a document viewer instance, it sometimes doesn't load the respective document in url. Reason is because we are using UIDocumentInteractionController, which according to Apple API documents, is supposed to be a preview controller, and recommended to initialize an instance for every different file previewed. Bug solved by creating new instance every time url is changed for document view.
  4. Chee Kiat Ng 2014-09-12

    PR here https://github.com/appcelerator/titanium_mobile/pull/6062
  5. Chee Kiat Ng 2014-09-12

    backport PR here https://github.com/appcelerator/titanium_mobile/pull/6064
  6. Olga Romero 2014-09-12

    Tested and verified Document Viewer is displaying PDF files. Environment Mac osx 10.9.4 Maverics Appcelerator Studio, build: 3.4.0.201409112242 Titanium SDK, build: 3.4.0.v20140912160914 acs@1.0.16 alloy 1.5.0-rc install@0.1.7 npm@1.4.23 sudo@1.0.3 titanium 3.4.0-rc2 titanium-code-processor@1.1.1 Xcode6 Device: iPhone 5S iOS8
  7. Olga Romero 2014-09-15

    reopened to change details

JSON Source