试图将“expires_date”字符串值转换为 NSDate 对象。
- 日期字符串 = "2019-08-18 15:12:09 America/Los_Angeles"
有什么建议么?
-(NSDate*)expires_date{
NSMutableDictionary * dictionary = [_dictionary mutableCopy];
NSString * date_string = [dictionary valueForKey:@"expires_date"];
//date_string = "2019-08-18 15:12:09 America/Los_Angeles"
NSDateFormatter *dateFormatter = [IAPSKReceipt formatter];
NSDate *date = [dateFormatter dateFromString:date_string];
return date;
}
+(NSDateFormatter*)formatter{
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter = [NSLocale localeWithLocaleIdentifier:@"en_US"];
dateFormatter = @"yyyy-MM-dd HH:mm:ss";
dateFormatter = [NSTimeZone timeZoneForSecondsFromGMT:0];
return dateFormatter;
}