UIPrintInteractionController throws warning: Unbalanced calls to begin/end appearance transition

Hello,


Upon the [pic presentAnimated:YES completionHandler:completionHandler] calls, I get this warning from the console:

Unbalanced calls to begin/end appearance transition for <UIViewController: 0x....> . It doesn't crash though, and I don't see this warnings from the iPad.

Does anybody get this message too?


Thanks!


-(void)BA_handlePrintTapped:(id)sender {
    [SVProgressHUD showLoading];
    UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
    pic.delegate = self;
    UIPrintInfo *printInfo = [UIPrintInfo printInfo];
    printInfo.outputType = UIPrintInfoOutputGeneral;
    printInfo.jobName = @"my job;
    printInfo.duplex = UIPrintInfoDuplexLongEdge;
    pic.printInfo = printInfo;
    pic.showsPageRange = YES;
    UIMarkupTextPrintFormatter *textPrint = [[UIMarkupTextPrintFormatter alloc] initWithMarkupText:[NSString stringWithFormat:@"<html>test test</html"];
    NSLog(@"html is %@", textPrint.markupText);
    pic.printFormatter = textPrint;
    void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
    ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
        [SVProgressHUD dismiss];
        if(completed) {
            NSLog(@"complete");
        }
        else {
            NSLog(@"failed");
        }
    };
    if(IDIOM == IPAD) {
        [pic presentFromBarButtonItem:self.printBarButton animated:YES completionHandler:completionHandler];
    }
    else {
        [pic presentAnimated:YES completionHandler:completionHandler];
    }
}

Replies

Hi,


the same :

Only Single View Application (swift) + a UITextView + a UIButton (print) which do printAction :

the sheet for printing options appears and crashes

log :

"Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x7f883be6bad0>"


For me the app crashes


Xcode 7 - iOS 9.0


Maybe better in Xcode 7.1

Search hours later… :


It's OK when I unplug my iPhone and test the app without debugger.

All works fine ! (on the iPhone, not on the simulator, nor on the iPhone USB/plugged)


Hope this help ?

I have a similar problem.


DId you find a solution?

I have the same problem. I have two similar apps, one crashes, the other does't. Both are ok when run in the deviece, not connected to Xcode.

I'm getting the same warning and have yet to figure out what is going on. The results seem to vary depending on what simulator is run e.g.


iPhone 4S - get just an "unbalanced calls to begin/end appearance transition" message

iPhone 5 - get just an "unbalanced calls to begin/end appearance transition" message

iPhone 5S - get a "UICollectionView Flow layout not defined" message

iPhone 6 & iPhone 6S- get just an "unbalanced calls to begin/end appearance transition" message

iPhone 6 Plus iPhone 6S Plus- get both the "unbalanced calls ..." message and the "UICollectionView Flow layout not defined" message


The printing still seems to work OK despite the warnings, but I would like to remedy this before submitting my App to the App store.


It looks to me like a bug with Apple's software, but I was wondering if anyone has found a workaround or a proper fix?


Regards

Trevor

So, Apple??? How can we fix this? The first message is from October 7, 2015, almost 8 months ago.


Is there anyone who solves this issue??

I got the same issue and for me it was a problem with the printInteractionControllerParentViewController.

A solution here : http://stackoverflow.com/a/37644779/2829203

I found that returning self in the delegate method printInteractionControllerParentViewController resolved that issue for me.