【问题标题】:iPhone simulator doesn't see my NSString categoryiPhone 模拟器看不到我的 NSString 类别
【发布时间】:2010-06-22 16:02:50
【问题描述】:

我有一个 NSString 类别如下的应用程序:

@interface NSDate(ISO8601Parsing)



//This method is the one that does all the work. All the others are convenience methods.

+ (NSDate *)dateWithString:(NSString *)str strictly:(BOOL)strict getRange:(out NSRange *)outRange;

+ (NSDate *)dateWithString:(NSString *)str strictly:(BOOL)strict;



//Strictly: NO.

+ (NSDate *)dateWithString:(NSString *)str timeSeparator:(unichar)timeSep getRange:(out NSRange *)outRange;

+ (NSDate *)dateWithString:(NSString *)str timeSeparator:(unichar)timeSep;

+ (NSDate *)dateWithString:(NSString *)str getRange:(out NSRange *)outRange;

+ (NSDate *)dateWithString:(NSString *)str;



@end

类别在最终应用程序中,而不是在静态库中。 当我在iPhone(3GS和iOS4)上使用该应用程序时,应用程序和测试都没有问题。 当我使用 iPhone 模拟器时,我添加的方法不会被调用。调试我已经看到 xcode '跳过'调用并返回 null,非常奇怪。 有什么建议吗? 谢谢。 让

【问题讨论】:

  • 我会先尝试“清理所有目标”(关闭构建菜单) - 您可能有不同的半构建代码位用于模拟器和设备。为了安全起见,我也会从两者中卸载它:)

标签: iphone xcode ios4


【解决方案1】:

我在使用 wsdl2objc 生成的代码时遇到了同样的问题(请参阅issue)。我通过重命名一种方法来解决它:

+ (NSDate *)dateWithString:(NSString *)str

例如

+ (NSDate *)wsdl2objcDateWithString:(NSString *)str;

上面的代码和新的私有 API 之间似乎存在冲突,但我不确定。

【讨论】:

    【解决方案2】:

    rehos 是正确的 - 谢谢

    只是为了让像我这样的菜鸟更清楚;

    NSDate+ISO8601Parsing.m和.h中的重命名方法


    +(NSDate *)deserializeNode:(xmlNodePtr)cur中使用重命名方法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-15
      • 1970-01-01
      • 1970-01-01
      • 2012-04-05
      • 1970-01-01
      • 1970-01-01
      • 2013-08-19
      相关资源
      最近更新 更多