【问题标题】:iphone Can someone please explain to me what #ifdef does here?iphone 有人可以向我解释一下#ifdef 在这里做什么吗?
【发布时间】:2011-03-19 22:31:31
【问题描述】:

有人可以解释一下#ifdef..#else..#endif 在这段代码中的作用吗?它来自一个开源的 iphone twitter 客户端。

#ifdef ENABLE_OAUTH
@interface NTLNTwitterClient : NTLNOAuthHttpClient {
#else
@interface NTLNTwitterClient : NTLNHttpClient {
#endif
    int requestPage;
    NSString *screenNameForUserTimeline;
    BOOL parseResultXML;
    NSObject<NTLNTwitterClientDelegate> *delegate;
    BOOL requestForTimeline;
    BOOL requestForDirectMessage;
    NTLNTwitterXMLParser *xmlParser;
}

【问题讨论】:

    标签: iphone twitter conditional-compilation


    【解决方案1】:

    如果在其他地方定义了 ENABLE_OAUTH,则类 NTLNTwitterClient 将是 NTLNOAuthHttpClient 的子类。

    如果未定义 ENABLE_OAUTH,则 NTLNTwitterClient 类将是 NTLNHttpClient 的子类。

    【讨论】:

    • 酷。感谢您的回复!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-17
    • 2014-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-26
    相关资源
    最近更新 更多