簡體   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