为iOS4.3和iOS5.0构建问题 [英] Problems building for both iOS4.3 and iOS5.0

查看:92
本文介绍了为iOS4.3和iOS5.0构建问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一些问题,试图将一些特定于iOS5的库整合到一个针对iOS5和iOS4.3的应用中。我已经完成了以下步骤:

I'm running up against problems trying to incorporate some iOS5-specific libraries into an app targeted at both iOS5 and iOS4.3. I've gone through the following steps:


  • 通过在链接二进制文件中将其设置为可选,将Twitter框架弱链接库

  • weakly-linked the Twitter framework by setting it as optional in 'Link Binary with Libraries"

将其作为其他链接器标志中的iOS5.0 SDK的框架添加到`-framework Twitter.framework'

added it as a framework for the iOS5.0 SDK in Other Linker Flags with `-framework Twitter.framework'

有条件地链接类头中的框架:

conditionally linked the framework in the class header:

#if defined(__IPHONE_5_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0
#import <Twitter/Twitter.h>
#import <Accounts/Accounts.h>
#endif


  • 然后在方法本身,我正在检查用户是否为Twitter设置:

  • then in the method itself, I'm then checking whether the user's set up for Twitter:

    if ([TWTweetComposeViewController class]) {
        self.canTweet = [TWTweetComposeViewController canSendTweet];
    }
    


  • 这在5.0和4.3模拟器上都能很好地工作。但是,我'得到它有问题为实际设备运行或存档。

    This works beautifully on both the 5.0 and 4.3 simulators. However, I've got problems getting it to run on, or archive for, actual devices.

    当我有一个运行5.0的3GS或连接的4运行5.0时,两者都出现在计划下拉列表。选择最上面的一个,并尝试构建或运行项目失败,并带有使用未识别的标识符'TWTweetComposeViewController'错误。

    When I've got either a 3GS running 5.0, or a 4 running 5.0 attached, both show up twice in the Scheme dropdown. Selecting the top one, and attempting build or run the project fails with an Use of unidentified identifier 'TWTweetComposeViewController' error.

    使用第二个设备条目,构建失败,发现 ld:框架未找到Twitter.framework 错误。

    Using the second device entry, the build fails with a ld: framework not found Twitter.framework error.

    我确信这里有一些我不知道的东西,但我很难过。任何人都可以提供建议吗?

    I'm sure there's something I'm missing here, but I'm stumped. Can anyone advise?

    推荐答案

    如果您使用的是一周链接,那么您必须使用
    检查API的首次可用性NSClassFromString,respondsToSelector,instancesRespondToSelector等。
    所以,改变你的if条件。首先尝试使用上面指定的运行时函数来获取类对象。

    这里是一个链接,详细说明了如何执行此操作。
    链接

    If you are using a week linking then you have to check first availability of API using NSClassFromString, respondsToSelector, instancesRespondToSelector etc. So, change your if condition. First try to get your class object using above specified runtime function.
    here is a link explaining in detail how to do such. link

    这篇关于为iOS4.3和iOS5.0构建问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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