我为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
Run Code Online (Sandbox Code Playgroud)
该类别位于最终应用程序中,而不是静态库中.当我在iPhone上使用该应用程序(带有iOS4的3GS)时,应用程序和测试都没有问题.当我使用iPhone模拟器时,我没有调用添加的方法.调试我已经看到xcode'跳过'调用并返回null,非常奇怪.有什么建议吗?谢谢.吉恩
我在使用 wsdl2objc 生成的代码时遇到了同样的问题(请参阅问题)。我通过重命名一种方法解决了这个问题:
+ (NSDate *)dateWithString:(NSString *)str
Run Code Online (Sandbox Code Playgroud)
例如
+ (NSDate *)wsdl2objcDateWithString:(NSString *)str;
Run Code Online (Sandbox Code Playgroud)
看起来上面的代码和新的私有 API 之间存在冲突,但我不确定。
| 归档时间: |
|
| 查看次数: |
727 次 |
| 最近记录: |