Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8376379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:25:09+00:00 2026-06-09T15:25:09+00:00

In my iOS app, I have the following code that is being used for

  • 0

In my iOS app, I have the following code that is being used for AirPrinting a simple NSString.

#pragma mark - Print
-(IBAction)print:(id)sender {

    UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
    pic.delegate = self;

    UIPrintInfo *printInfo = [UIPrintInfo printInfo];
    printInfo.outputType = UIPrintInfoOutputGeneral;
    printInfo.jobName = @"Message";
    pic.printInfo = printInfo;

    UISimpleTextPrintFormatter *textFormatter = [[UISimpleTextPrintFormatter alloc]initWithText:self.Message.text];
    textFormatter.startPage = 0;
    textFormatter.contentInsets = UIEdgeInsetsMake(72.0, 72.0, 72.0, 72.0); // 1 inch margins
    textFormatter.maximumContentWidth = 6 * 72.0;
    pic.printFormatter = textFormatter;
    pic.showsPageRange = YES;

    void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
    ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
        if (!completed && error) {
            NSLog(@"Printing could not complete because of error: %@", error);
        }
    };
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        [pic presentFromBarButtonItem:sender animated:YES completionHandler:completionHandler];
    } else {
        [pic presentAnimated:YES completionHandler:completionHandler];
    }
}

When I run my project (to test it), this is the error I get in the Output Debugger Window when I tap “Print” on the UIPrintInteractionController:

Simulated\032InkJet\032@\032USER\032NAME\032iMac._ipp._tcp.local.: startJob: Unable to connect to printd: Connection refused

I get this error in the iOS 5.1 Simulator using the Print Simulator. Why am I getting this error? I have a feeling it has to do with how I am using the Print Simulator.

Any help is appreciated, and just as a side note, does anyone know how to display the UIPrintInteraction controller from a normal UIButton on the iPad instead of a BarButtonItem?

EDIT: It should be noted that AirPrint is automatically setup when using Share Sheets in iOS 6.0+.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:25:10+00:00Added an answer on June 9, 2026 at 3:25 pm

    I had the exact same problem and basically mincemeat’s answer fixed the issue. However I did have to jump through a few hoops first. Ultimately it was some sort of file permissions problem.

    I did the following (note, admin access is required):

    1. Open Terminal and navigate to folder /private/var/tmp/

    2. type ‘whoami’ to see your exact user name.

    3. Let’s say your user name is ‘dogtest’. type ‘sudo chown dogtest:admin printd’. You’ll get a warning that basically asks you to make sure you know what you’re doing.

    4. Enter your admin password and hit enter.

    5. Now you have ownership of the printd file and can do what you want with it. Rename the file to something else by typing ‘mv printd printd-ren’.

    6. Open iOS Simlulator and Printer Simulator.

    7. Open Safari in iOS Simulator and go to any webpage.

    8. Tap the Share button at the bottom center and choose Print.

    9. Follow the prompts to complete the print. You should see a lot more activity in the Printer Simulator log window. At this point the printd file is recreated with your account permissions (that’s good).

    10. Quit both iOS Simlulator and Printer Simulator.

    11. Re-rerun your iOS app in the simulator and then reopen Printer Simulator.

    12. Now you should be able to simulate Air Print from your app and the print-out will open in Preview as a PDF.

    I hope this solves the problem for you or at least points you in the right direction. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app is crashing in iOS 5 because I have some code that is
I have the following code in my XCode project for an iOS app I'm
I am making a drawing app for iOS and I have the following classes:
In my iOS app I have several UIElement s that can process user input:
I have an iOS app that uses a number of enums for valid values,
I have an iOS app with a UITableView that has flexible width, which allow
I have an old iOS app that I never distributed and am now trying
I have an iOS app that posts to users FB feeds with a link,
I have the following code: ofstream mOutFile.open(logPath, ios_base::app); string lBuilder; lBuilder.append(========================================================\n); lBuilder.append(Date: ); lBuilder.append(asctime(timeinfo));
I have the following structure in my app (iPad, iOS 5): UIView1 --> UIView2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.