繁体   English   中英

用于打印的弱链接框架

[英]Weak Linking Framework for Printing

我有一个使用邮件和打印例程的简单项目。 对于打印,我有一个 UIPrintPageRenderer 的子类。 我正在遵循 Apple 关于使用弱链接类的指南

- The base SDK for your Xcode project must be iOS 4.2 or newer. The name for this setting in the build settings editor is SDKROOT (Base SDK).
- The deployment target for your project must be iOS 3.1 or newer. The name for this setting is MACOSX_DEPLOYMENT_TARGET (Mac OS X Deployment Target).
- The compiler for your project must be the LLVM-GCC 4.2 compiler or newer, or the LLVM compiler (Clang) 1.5 or newer. The name for this setting is GCC_VERSION (C/C++ Compiler Version).
- You must ensure that any frameworks not available in your project’s deployment target are weakly linked, rather than required. See “Weak Linking to an Entire Framework” and “Linking Libraries and Frameworks” in Xcode Project Management Guide.

问题

我在应用程序启动时仍然收到错误:

2011-07-08 10:47:19.819 MyTestProject[47013:207] *** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x5a2aac0
2011-07-08 10:47:19.821 MyTestProject[47013:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x5a2aac0'
2011-07-08 10:47:19.822 MyTestProject[47013:207] Stack: (
    43358288,
    44516140,
    43367003,
    42829430,
    42826226,
    9319,
    1149252,
    1153359,
    1178942,
    1160439,
    1192408,
    47780220,
    42637468,
    42633384,
    1151521,
    1184626,
    9129,
    8997
)
terminate called after throwing an instance of 'NSException'

当我尝试为 iPad 3.2 模拟器运行我的应用程序时,我得到了这个。 知道为什么吗?

ps 代码适用于 iPad 4.2 和 4.3。

UIWindow文档中,属性rootViewController仅适用于 iOS 4.0 及更高版本(因此, setRootViewController也是如此):

根视图控制器

window 的根视图 controller。

@property(nonatomic,retain) UIViewController *rootViewController

讨论

根视图 controller 提供 window 的内容视图。 将视图 controller 分配给此属性(以编程方式或使用 Interface Builder)将视图控制器的视图安装为 window 的内容视图。 如果 window 具有现有的视图层次结构,则在安装新视图之前删除旧视图。

此属性的默认值为 nil。

可用性

在 iOS 4.0 及更高版本中可用。

这就是您的应用程序在 iOS 3.2 上崩溃的原因,但在 iOS 4.2 和 4.3 上却没有。

我认为您将无法在低于 4.2 的 iOS 上打印而无需任何额外服务。 在 iOs 4.2 或更高版本上,预装了支持 AirPrint 的打印机驱动程序(如果我没记错的话)。 在较低的 iO 上,这些驱动程序未安装且无法安装。

这来自: How to Print a document from iphone below ios 4.2 版

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM