iphone - NSString to NSDate issue IOS7 -
i'm using following code convert nsstring
nsdate
:
nsdate *date = [nsdate convertstringtodate:strdate andformatter:@"mm dd"]; + (nsdate *)convertstringtodate:(nsstring *)datestring andformatter:(nsstring *)formatter { nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; // imporant - set our input date format match our input string // if format doesn't match you'll nil string, careful [dateformatter setdateformat:formatter]; dateformatter.timezone = [nstimezone systemtimezone]; return [dateformatter datefromstring:datestring]; }
nsstring @"07 15"
. nsdate nil
. on simulator fine on device ios7 nil.
do have suggestions it?
if code works in ios 6, may bug in ios 7. sure file bug report if think that's case.
if doesn't work in ios 6, may month , day aren't sufficient specify date. try adding year , see if valid date way.
note questions ios 7 should posted apple's developer forums, not here.
Comments
Post a Comment