ios - 从 TM-P60II 打印时 Epson ePos sdk 错误

标签 ios printing bluetooth epson

我正在使用 epson ePOS sdk 从 iOS 打印到 TM-P60II。我可以连接和打印,但只有一两次。一两次尝试后出现超时错误,然后必须重新启动应用程序才能再次打印。我已经用他们在 sdk 中的示例以及他们手册中 p37 上的示例复制了错误。关闭/释放打印机时看起来像是某种错误。我已经向他们的技术支持寻求帮助,但 1 个月后 4 封电子邮件没有回复。 (其实前线支持很好,2nd tier 是问题。)

我的问题是,有没有人遇到过这种情况并制定了解决方法?我正在考虑尝试使用 Zebra iMZ220(对此举的评论表示赞赏),但我已经完成了 90%,不想从头开始。

谢谢!

p37 示例如下所示:

更新:Epson 联系了我们,发现这是 iOS 7.1 的一个已知错误。目前还没有关于修复的消息。

更新 2:新的 sdk 出来了……仍然没有用。但是,如果您在似乎可以解决问题的单独队列中启动它。当队列自动释放时,未释放的打印机项目也会随之释放。无论如何,如果我没有造成内存泄漏,那就更好了。

更新 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];
    }
}

//-------- 解决方法--------

// 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];
    });
});

最佳答案

我的 P60II 也有这个问题,最后调用 Epson。第一级支持将我送到第二级,后者说他们有固件更新。我通过并填写了他们通过电子邮件发送给我的表格,并在大约 30 分钟内获得了固件。更新似乎已经解决了这个问题。我调用的号码是 (562) 276-1314,我选择了开发人员支持。

关于ios - 从 TM-P60II 打印时 Epson ePos sdk 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22769907/

相关文章:

c++ - C++中的打印功能不起作用

c# - .NET 的视觉打印设计

python - 无法格式化打印字符串

java - 在android中通过蓝牙发送文件时出错?

ios - 切换到横向,自动约束在错误的角落

ios - 设置 UIScrollview 和自动布局

ios - Xcode UITableView 单元格背景不起作用

android - BLE 设备在完美运行数周后停止与 Android 连接

android - 如何从 WebRTC 连接到外部扬声器

ios - 如何在没有电缆的情况下(通过 WIFI - 蓝牙)从 Xcode 版本 6.2 (6C131e) 向设备运行 iOS 应用程序?