【发布时间】:2010-11-28 16:22:44
【问题描述】:
我正在尝试向 ios 应用程序添加打印功能。 虽然打印本身可以正常工作,并且该应用程序可以在 ios > 4 上运行,但我还没有弄清楚如何保持 ios 3.1 兼容性...
我猜问题是这样的:completionHandler:(UIPrintInteractionCompletionHandler)
你实现的 UIPrintInteractionCompletionHandler 类型的块来处理 打印作业的结束(例如,重置状态)和 处理打印中遇到的任何错误。
一旦我添加了块:
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
};
该应用甚至无法在 iOS 3.1 上启动 可能是因为那里没有可用的块。
是的,我确保在 iOS 3.1 上启动时不会运行此代码...
if (([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.2) && ([UIPrintInteractionController isPrintingAvailable]))
所以我想知道是否有办法为 iOS >4.2 提供打印支持,但让它在 iOS 3.1 上运行?
也许有一种方法可以使用方法而不是“块”? 或者如何在受支持的 iOS 设备上进行打印并保持向后兼容 iOS 3.1 的正确方法是什么?
【问题讨论】:
-
简短回答:不要使用 LLVM 编译器 1.6。 1) 您的项目的 Base SDK 必须是 iOS 4.2(或更高版本),2) 您的项目的部署目标必须是 iOS 3.1 或更高版本。 (所以你需要放弃 pre-3.1 iPhone 兼容性。),3)你项目的 C/C++ Compiler Version 必须是 LLVM GCC 4.2(如果你需要支持 pre-4.0 iOS)或 LLVM compiler 1.6(如果你只支持 iOS 4.0及以上,因为它不会弱链接支持块)。 ----/ 在 2010 年 11 月 22 日的帖子中找到了这个答案:marco.org
标签: iphone printing backwards-compatibility