보기에 두 개의 UIDatePicker가 있습니다. 하나는 날짜를 얻고 다른 하나는 시간을 얻는 것입니다. 나는 시간을 제대로 얻고있다. 이제 Local Notification의 firedate 설정을 위해 Date를 Time을 추가해야합니다. txtDate.text 8 월, 06 2012과 txtTime.text은 오후 7시 4분 동안 모두를 추가, 나는 NSDate에 시간 추가
NSDateFormatter *dateFormat=[[NSDateFormatter alloc]init];
[dateFormat setDateFormat:@"MMM,dd YYYY HH:mm a"];
[dateFormat setLocale:[NSLocale currentLocale]];
[dateFormat setTimeZone:[NSTimeZone systemTimeZone]];
NSDate *tempDate = [dateFormat dateFromString:[NSString stringWithFormat:@"%@ %@",txtDate.text,txttime.text]];
localNotif.fireDate = tempDate;
있는 NSDate
에 null을 얻고있다. tempDate가 null로 표시됩니다. 나는 이것을 위해 다양한 날짜 형식을 시도했다. 제발 제안 해주세요.
재생 해 주셔서 감사합니다. 귀하가 제안한 형식을 변경했습니다. 여전히 영향은 없습니다. – Arvind
@Arvind 그리고 ios/macos에서 사용 된 시간 리터럴에 대해 자세히 알아볼 수있는 링크가 있습니다. http://unicode.org/reports/tr35/tr35-10.html#Date_Format_Patterns –
@Arvind 나는 dateformat을 업데이트했습니다. 위의 링크를 기반으로 시도해 볼 수 있습니까? – wattson12