1
私は携帯電話の時計から時間を取得しようとしているが、あなたは、コードの行を逃したこのxcode 4の電話機から時間を取得する際にエラーが発生しましたか?
NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components =
[gregorian components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:today];
NSInteger hour = [components hour];
NSInteger minute = [components minute];
NSInteger second = [components second];
を使用して、このコードに
NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSInteger hour = [components hour];
NSInteger minute = [components minute];
NSInteger second = [components second];