开发者

NSDateComponents setTimeZone NSInvalidArgumentException at iOS 3.1

[NSDateComponents setTimeZone:] function crashes at iOS 3.1, gives开发者_如何转开发 NSInvalidArgumentException. but it works fine at higher iOS versions. Is there anyone who has a solution for this? thanks in advance.


This method is (publicly) available starting 4.0 OS only so you must not call that method on 3.x OS - perform run-time check if NSDateComponent instance responds to selector before calling it:

NSDateComponents* comps = ...;
if ([comps respondsToSelector:@selector(setTimeZone:)])
    [comps setTimeZone:zone];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜