Cómo formatear convertir la cadena 2013-01-27T02: 31: 47 + 08: 00 en NSDate
He intentado muchas veces convertir la cadena2013-01-27T02:31:47+08:00
en NSDate. He encontrado elguía de formato Por Apple y copió su código y lo intentó, pero no funciona.
NSDateFormatter *rfc3339DateFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
[rfc3339DateFormatter setLocale:enUSPOSIXLocale];
[rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"];
[rfc3339DateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:8]];
// Convert the RFC 3339 date time string to an NSDate.
NSDate *date = [rfc3339DateFormatter dateFromString:@"2013-01-27T02:31:47+08:00"];