在iOS上检查运行时块的可用性 [英] Check for availability of blocks at runtime on iOS

查看:108
本文介绍了在iOS上检查运行时块的可用性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在运行时测试块的可用性,因此我可以处理与iOS 3的向后兼容性。任何提示?

I need to test for the availability of blocks at runtime, so I can handle backwards compatibility with iOS 3. Any tips?

编辑:
所以我正在做 if(!NSClassFromString(@NSBlockOperation)){...}
似乎工作......

edit: So far I'm doing if (!NSClassFromString(@"NSBlockOperation")) {...} Seems to be working...

推荐答案

您还需要确保弱链接 libSystem.B.dylib ,将基本SDK设置为4.0,将部署目标设置为3.1.3,如上所述这里

You will also need to make sure to weak link the libSystem.B.dylib, set your base SDK to 4.0 and deployment target to 3.1.3, as described here.

还可以找到关于如何处理iOS版本问题的一个很好的概述在这篇Cocoa with Love文章中:提示&有条件的iOS3,iOS3.2和iOS4代码的技巧

A good overview on how to deal with iOS versioning issues can also be found in this this Cocoa with Love article: Tips & Tricks for conditional iOS3, iOS3.2 and iOS4 code

这篇关于在iOS上检查运行时块的可用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆