Nel*_*onH 5 printing bluetooth epson ios
我正在使用epson ePOS sdk从iOS打印到TM-P60II.我可以连接和打印,但只能打印一次或两次.尝试一两次后我收到超时错误,然后必须重新启动应用程序才能再次打印.我在他们的手册中重复了他们在sdk中的示例和p37中的示例中的错误.关闭/释放打印机时看起来像某种错误.我已经向他们的技术支持部门寻求帮助,但是1个月后又发送了4封电子邮件而没有回复.(实际上前线支持很好.第二层是问题.)
我的问题是,有没有人经历过这个并开发出一种解决方法?我正在考虑尝试使用Zebra iMZ220(对这一举动的评论赞赏),但我有90%的方式,并且不愿意从头开始.
谢谢!
这是p37样本的样子:
更新:被Epson联系,结果证明这是iOS 7.1的一个已知错误.还没有任何关于修复的消息.
UPDATE2:新的sdk out ...仍然无法正常工作.但是,如果您在一个单独的队列中启动它,似乎可以解决问题.当队列自动释放时,未发布的打印机项目随之而来.无论如何提供更好的练习我还没有创建内存泄漏.
更新3:请参阅下面的代码.是的它没有抛光.请注意,PrinterUtils只是我对epson打印功能的包装.任何评论欢迎和HTH.
id builder2 = [[EposBuilder alloc] initWithPrinterModel: @"TM-P60II" Lang: EPOS_OC_MODEL_ANK];
if (builder2 != nil) {
errorStatus = EPOS_OC_SUCCESS;
//Create a print document
errorStatus = [builder2 addText: @"Hello,\t"];
errorStatus = [builder2 addText: @"World!\n"];
errorStatus = [builder2 addCut: EPOS_OC_CUT_FEED];
//Initialize an EposBuilder class instance for confirmation
id conBuilder2 = [[EposBuilder alloc] initWithPrinterModel: @"TM-P60II" Lang: EPOS_OC_MODEL_ANK];
//Initialize an EposPrint class instance
id printer2 = [[EposPrint alloc] init];
unsigned long status;
int connectionType = EPOS_OC_DEVTYPE_BLUETOOTH;
if (printer2 != nil) {
//<Start communication with the printer>
errorStatus = [printer2 openPrinter:connectionType DeviceName:macAddress Enabled:EPOS_OC_FALSE Interval:EPOS_OC_PARAM_DEFAULT];
//Send Data for confirmation
errorStatus = [printer2 sendData:conBuilder2 Timeout:10000 Status:&status];
if ((errorStatus = EPOS_OC_SUCCESS && (status & EPOS_OC_ST_OFF_LINE ) != EPOS_OC_ST_OFF_LINE) ) {
//<Send print data>
errorStatus = [printer2 sendData:builder2 Timeout:10000 Status:&status]; }
//<End communication with the printer>
errorStatus = [printer2 closePrinter];
}
}
Run Code Online (Sandbox Code Playgroud)
// --------解决方法--------
// Busy Spinner
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.center = CGPointMake (self.view.bounds.size.width * 0.5F, self.view.bounds.size.height * 0.5F);
spinner.hidesWhenStopped = YES;
[self.view addSubview:spinner];
[spinner startAnimating];
spinner.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);
// Launch new queue
dispatch_queue_t myQueue = dispatch_queue_create("My Sync Queue",NULL);
dispatch_async(myQueue, ^{
PrinterUtils *pu = [[PrinterUtils alloc] init];
EposBuilder *builder = [pu getNewEposBuilder];
EposPrint *printer = [pu getNewEposPrinter];
[pu setPrintStyle:PRINTSTYLE_BODY2 eposBuilder:builder];
[pu loadTextLine:@"bm print to tm-p60II" eposBuilder:builder];
[pu print:builder eposPrint:printer ];
[pu closePrinterConnection];
dispatch_async(dispatch_get_main_queue(), ^{
// Update the UI
[spinner stopAnimating];
});
});
Run Code Online (Sandbox Code Playgroud)
小智 0
我的 P60II 也遇到了这个问题,最终致电 Epson 询问此事。第一级支持将我发送到第二级,他们说他们有固件更新。我浏览并填写了他们通过电子邮件发送给我的表格,并在大约 30 分钟内获得了固件。更新似乎已经纠正了该问题。我拨打的号码是 (562) 276-1314,我选择了开发人员支持。