Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18730] iOS8: DocumentViewer: Unbalanced calls to begin/end appearance transitions for QLRemotePreviewContentController

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-05-14T17:38:31.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0, Release 4.1.0
ComponentsiOS
Labelstriage
ReporterEduardo Gomez
AssigneeVishal Duggal
Created2015-03-23T22:18:06.000+0000
Updated2017-03-16T21:49:25.000+0000

Description

Issue Description

We get the following message when loading a pdf in the DocumentViewer component: "Unbalanced calls to begin/end appearance transitions for ". Getting this message is sometimes associated with the app freezing but generally app goes okay anyway.

Sample Code

var doc = "http://www.legis.state.ak.us/basis/iphonepages/IPV3get_documents.asp?session=29&docid=3324&minname=Agenda%5FLBA%5F17Mar15%5FLocation+Change%2Epdf";
var win = Ti.UI.createWindow();
win.open();
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'document.pdf'),
    client = Ti.Network.createHTTPClient({
	onload : function() {
		// Open a doc viewer.
		var docViewer = Ti.UI.iOS.createDocumentViewer({
			url : file.nativePath
		});
		docViewer.show({
			animated : true
		});
	},
	onerror : function(e) {
		alert('Error: ' + e);
	}
});
client.open('GET', doc);
client.file = file;
client.send(); 

Console Output

-- Start simulator log -------------------------------------------------------
[INFO]  Application started
[DEBUG] Reading stylesheet from: /Users/egomez/Library/Developer/CoreSimulator/Devices/D2DD3F81-EDBF-4C3B-A975-A41501FF3702/data/Containers/Bundle/Application/AE4C1686-4155-44A9-A3F5-AF463281A0F4/TableViewRepro.app/stylesheet.plist
[DEBUG] 2015-03-23 16:01:38.614 TableViewRepro[10909:330239] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
[DEBUG] 2015-03-23 16:01:38.615 TableViewRepro[10909:330239] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
[INFO]  TableViewRepro/1.0 (4.0.0.944c821)
[DEBUG] Loading: /Users/egomez/Library/Developer/CoreSimulator/Devices/D2DD3F81-EDBF-4C3B-A975-A41501FF3702/data/Containers/Bundle/Application/AE4C1686-4155-44A9-A3F5-AF463281A0F4/TableViewRepro.app/app.js, Resource: app_js
[DEBUG] Application booted in 415.318012 ms
[DEBUG] 2015-03-23 16:01:40.414 TableViewRepro[10909:330239] Unbalanced calls to begin/end appearance transitions for <QLRemotePreviewContentController: 0x7fe105059000>.

Comments

  1. Sebastian Klaus 2015-04-23

    I'm geting this error too on iPhone 6 with 8.3 and SDK 3.5.1.GA Opening a PDF works random. And sometimes it crashes with this error. Hope, this will be fixed soon.
  2. Vishal Duggal 2015-05-12

    This might very much be an Apple bug. Essentially the View controller that is presenting the Document Viewer is in the process of disappearing while the preview is coming up. This is root cause of the warning about Unbalanced calls to begin/end appearance transitions. Not much we can do about it. Unrelated to this there are a couple of bugs in the Document Viewer. Test case here
       var doc = "http://www.legis.state.ak.us/basis/iphonepages/IPV3get_documents.asp?session=29&docid=3324&minname=Agenda%5FLBA%5F17Mar15%5FLocation+Change%2Epdf";
       var win = Ti.UI.createWindow({backgroundColor:'blue'});
       var win2 = Ti.UI.createWindow({backgroundColor:'yellow'});
       var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'document.pdf');
       
       var client = Ti.Network.createHTTPClient({
       	onload : function() {
       		// Open a doc viewer.
       		var docViewer = Ti.UI.iOS.createDocumentViewer({
       			url : file.nativePath
       		});
       		docViewer.show({
       			animated : true
       		});
       	},
       	onerror : function(e) {
       		alert('Error: ' + e);
       	}
       });
       
       var presentViewer = true;
       
       function presentDocument(){
       	if(presentViewer) {
       		presentViewer = false;
       		client.open('GET', doc);
       		client.file = file;
       		client.send(); 
       	} else {
       		win2.close();
       	}
       }
       
       win2.addEventListener('focus',function(){
       	presentDocument();
       })
       
       win.addEventListener('focus',function(){
       	if(presentViewer) {
       		win2.open({modal:true});
       	}
       });
       win.open();
       
  3. Vishal Duggal 2015-05-12

    Pulls pending master - https://github.com/appcelerator/titanium_mobile/pull/6839 4_0_X - https://github.com/appcelerator/titanium_mobile/pull/6840
  4. Sebastian Klaus 2015-05-12

    I solved it with a timeout of 300 ms
  5. Lee Morris 2017-03-16

    Closing ticket as the issue has been fixed.

JSON Source