ios - NSDateComponents date is returning NSTaggedDate (internal class) instead of NSDate -


nscalendar *gcalendar = [[nscalendar alloc] initwithcalendaridentifier:nsgregoriancalendar]; nsdate *olddate = [nsdate date]; // or it. unsigned unitflags = nscalendarunityear | nscalendarunitmonth |  nscalendarunitday; nsdatecomponents *comps = [gcalendar components:unitflags fromdate:olddate]; comps.hour   = 23; comps.minute = 59; comps.second = 59; comps.calendar = gcalendar; nsdate *newdate = [gcalendar datefromcomponents:comps]; 

when run above snippet, newdate variable of type __nstaggeddate. ends causing problems, because __nstaggeddate not able json serialized later.

i trying create nsdate has time of last second of today.

i'm on xcode 6.4 , phone running ios 8.4. has happened on both simulator , iphone6.


Comments