如何模拟UIPrintInteractionController失败?

时间:2013-05-07 14:58:12

标签: ios printing

我有UIPrintInteractionController代码,我正在收集指标。

我没有支持AirPrint的打印机,我正在使用打印机模拟器。

我已经成功测试了成功的打印尝试,我将如何测试失败的打印尝试?

以下是代码:

    UIPrintInteractionCompletionHandler completionHandler =
^(UIPrintInteractionController *printController, BOOL completed,
  NSError *error) {
    if(!completed && error){
        NSLog(@"Print failed - domain: %@ error code %u", error.domain,
              error.code);
        // Log that print attempt failed
        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"shareMetricsData"] == YES) {
            [Flurry logEvent:@"Print Attempt Failed"];
        }
    } else {

        // Log that print attempt succeeded
        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"shareMetricsData"] == YES) {
            [Flurry logEvent:@"Print Attempt Succeeded"];
        }
    }
};

0 个答案:

没有答案