AirPrint Connection Refused Error

前端 未结 3 1021
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-03 00:19

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 {

    UIPrin         


        
相关标签:
3条回答
  • 2021-01-03 00:58

    Try removing

    /private/var/tmp/printd

    0 讨论(0)
  • 2021-01-03 01:09

    I had printer simulator stop working for me and not give me any errors at all. I tried different simulators, resetting them, restarting the computer, killing printd as mentioned above, and other things too.

    In the end, what fixed it for me was changing my network connections: at the time, i had wifi plus an ethernet cable (via thunderbolt) attached to my macbook -- both wifi + ethernet connected to the same network. I popped out the ethernet cable and immediately it started working again.

    Thanks Apple, where can I get my 20 mins back :)

    0 讨论(0)
  • 2021-01-03 01:12

    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 讨论(0)
提交回复
热议问题