मेरे आईओएस ऐप में, मेरे पास निम्न कोड है जिसका उपयोग एक सरल एनएसएसटींग एयरप्रिंटिंग के लिए किया जा रहा है।एयरप्रिंट कनेक्शन अस्वीकार त्रुटि
Simulated\032InkJet\[email protected]\032USER\032NAME\032iMac._ipp._tcp.local.: startJob: Unable to connect to printd: Connection refused
मैं इस त्रुटि मिलती है:
#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];
}
}
जब मैं अपने प्रोजेक्ट को चलाने (यह परीक्षण करने के लिए), यह त्रुटि मैं आउटपुट डीबगर विंडो में मिलता है जब मैं UIPrintInteractionController पर "प्रिंट" नल है प्रिंट सिम्युलेटर का उपयोग कर आईओएस 5.1 सिम्युलेटर में। मुझे यह त्रुटि क्यों मिल रही है? मुझे लगता है कि मैं प्रिंट सिम्युलेटर का उपयोग कैसे कर रहा हूं इसके साथ मुझे यह महसूस करना है।
किसी भी मदद की सराहना की जाती है, और एक साइड नोट के रूप में, क्या किसी को पता है कि BarButtonItem के बजाय आईपैड पर सामान्य UIButton से UIPrintInteraction नियंत्रक को कैसे प्रदर्शित किया जाए?
संपादित करें: यह ध्यान दिया जाना चाहिए कि आईओएस 6.0+ में शेयर शीट्स का उपयोग करते समय एयरप्रिंट स्वचालित रूप से सेटअप हो जाता है।
काम करता है। कृपया कमांड 'सीडी/निजी/var/tmp /' – Hassy