samedi 25 avril 2015

Converting seconds to mm:ss returns (null)


I'm trying to change seconds to mm:ss. I'm retrieving the seconds from a json file, it returns fine but once I try to convert it to mm:ss, it just returns (null)

NSDictionary *content = [video valueForKeyPath:@"media$group.yt$duration"];
NSString *thetimehere = [content valueForKeyPath:@"seconds"];


NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];    
[dateFormat setDateFormat:@"mm:ss"];

NSDate *dte = [dateFormat dateFromString:thetimehere];
cell.videolength.text = [NSString stringWithFormat:@"%@",dte ];
NSLog(@"Times: %@", dte);

What could be the response for the null response?!


Aucun commentaire:

Enregistrer un commentaire