Stack Overflow で質問をスキャンしたにもかかわらず、NSDate を一生動作させることができないので、助けていただければ幸いです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *publishedText = [NSString stringWithFormat:@"%@", feedLocal.published];
cell.publishedLabel.text = publishedText;
return cell;
}
私に文字列を与えます:
2013-05-08 18:09:37 +0000
2013 年 5 月 8 日午後 6 時 45 分
私は使用してみました:
NSString *publishedText = [NSString stringWithFormat:@"%@", feedLocal.published];
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSSSSS"];
NSDate *dateFromString = [[NSDate alloc] init];
dateFromString = [df dateFromString:publishedText];
cell.publishedLabel.text = dateFromString;
しかし、それは機能せず、ポインターの型に互換性がないという警告が表示されます ( NSString
to NSDate_strong
)。助けてくれてありがとう!