- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用邮件和打印例程的简单项目。对于打印,我有一个 UIPrintPageRenderer 的子类。我正在关注 Apple 的 guidelines使用弱链接类:
- 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 模拟器运行我的应用程序时,我得到了这个。知道为什么吗?
附注代码适用于 iPad 4.2 和 4.3。
最佳答案
来自documentation对于 UIWindow
,rootViewController
属性仅适用于 iOS 4.0 及更高版本(因此,setRootViewController
也是如此):
rootViewController
The root view controller for the window.
@property(nonatomic,retain)
UIViewController *rootViewControllerDiscussion
The root view controller provides the content view of the window. Assigning a view controller to this property (either programmatically or using Interface Builder) installs the view controller’s view as the content view of the window. If the window has an existing view hierarchy, the old views are removed before the new ones are installed.
The default value of this property is nil.
Availability
Available in iOS 4.0 and later.
这就是为什么您的应用程序在 iOS 3.2 上崩溃,但在 iOS 4.2 和 4.3 上却不会。
关于ios - 用于打印的弱链接框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6620259/
我一直在尝试编写我自己的弱/强指针,但我并不清楚其中的关系。我似乎遇到的所有事情都没有说清楚,而且一个医生经常会反驳另一个医生所说的话。任何人都可以详细解释弱/强指针关系,也许还有图像或代码示例吗?
静态/动态和强/弱类型之间有什么区别? 最佳答案 静态/动态类型涉及何时获取类型信息(在编译时或运行时) 强/弱类型是关于如何严格区分类型(例如,语言是否尝试从字符串到数字进行隐式转换)。 请参阅wi
我有一个非常奇怪的情况。我的服务器当前已关闭并收到 503 http 状态代码。基于如下给定的代码,代码进入 if 条件,但是当我将调试点置于 let error = self?.decodeErro
对于短期运行的操作,避免[weak self]是否可以接受?例如,URLSession 将保留 dataTask(with:completion:) 的闭包: final class ViewCont
我有一个非常奇怪的情况。我的服务器当前已关闭并收到 503 http 状态代码。基于如下给定的代码,代码进入 if 条件,但是当我将调试点置于 let error = self?.decodeErro
假设我有以下情况: Test1.java import java.lang.ref.WeakReference; public class Test1 { public WeakReferen
有没有办法告诉模拟器(我正在使用 Modelsim)当信号不是由任一双向接口(interface)驱动时将信号拉到弱“H”? 例如,如果我有一个 I2C 信号 I2C_SDA 被声明为来自 2 个模块
这是将一些值放入 WeakHashMap 中然后从映射中删除这些值的代码片段。它如何处理分配的内存? import java.util.*; public class WeakHashMap_Main
我正在尝试弄清楚智能指针可以实现什么。 但有一些感觉像是障碍。 普通指针有一个简短的定义 Someclass *p但是智能指针有点长shared_ptr p当您必须处理这些指针的模板(如 vector
这两行代码有区别吗? __weak IBOutlet UITextField *usernameField; @property (weak) IBOutlet UITextField *userna
我最近发现了 WeakHashMap Java 中的数据结构。 但是,我不明白它在不再正常使用时对映射进行垃圾收集是什么意思。数据结构如何知道我将不再在我的程序中使用 key ?如果长时间不引用 ke
我的问题是为什么 weak IBOutletCollection 总是 nil?如果将弱变强,我所有的按钮都在那里,这真的很奇怪。我试图理解苹果的逻辑,我看不出单个按钮和一组按钮在内存管理方面没有区别
我创建一个 WeakHashMap 为 WeakHashMap map = new WeakHashMap(); map.put(emp,"hello"); 其中 emp 是一个 Employee 对
在delphi sydney中,在对象(不是接口(interface))前面设置[weak]会受到惩罚吗?示例: TMyObject = class(Tobject) Private
在delphi sydney中,在对象(不是接口(interface))前面设置[weak]会受到惩罚吗?示例: TMyObject = class(Tobject) Private
众所周知,我们将声明一个可以打破强引用循环的弱委托(delegate)对象: // MyObject.h ... @property (nonatomic, weak) id delegate; ..
我已阅读this article关于Java中不同类型的引用(强引用、软引用、弱引用、幻像引用),但我不太理解。 这些引用类型之间有什么区别?每种类型何时使用? 最佳答案 Java 提供了两种不同类型
我突然想到...我相信弱引用的生命 与该引用的范围(在函数内或全局内)相关。 所以我想知道,只要我将数据处理保持在特定范围内,那么我应该可以使用 weak 与 strong 引用。正确的? 我问的原因
func addAdditionalElement(_ additionalSelectedElementsIDs: [String], startX: CGFloat, containerView:
我想要一个指针,以便我可以判断引用计数何时为 1。本质上,指针的工作方式类似于 weak_ptr,但清理工作需要手动进行。也就是说,程序每隔一段时间就会经历一个指针循环,并检查哪些指针只剩下一个引用。
我是一名优秀的程序员,十分优秀!