これは、iOS4.0 でコンパイルする前は問題なく動作していましたが、何が問題なのかわかりません。
これが問題です。データベースからアプリのスコアを日付/時刻とともに送信します。私の目標は、それを CoreData に格納することです。以下のコードを使用すると、日付に null 値が返されます。
コード:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"US"];
[dateFormatter setLocale:locale];
[dateFormatter setDateFormat:@"MM/dd/yyyy HH:mm:ss ZZZ"];
currentDownloadedScore.dateEntered = [dateFormatter dateFromString:self.currentValue];
NSLog(@"Date CV: %@",self.currentValue);
NSLog(@"Date: %@",[currentDownloadedScore.dateEntered description]);
[locale release];
[dateFormatter release];
デバッガーでの結果は次のとおりです。
2010-07-16 08:15:35.741 MyApp[75003:207] Date CV: 07/16/2010 04:21:00 +00:00
2010-07-16 08:15:35.742 MyApp[75003:207] Date: (null)
2010-07-16 08:15:35.745 MyApp[75003:207] Date CV: 07/16/2010 01:09:26 +00:00
2010-07-16 08:15:35.749 MyApp[75003:207] Date: (null)
どんな助けでも大歓迎です!ありがとう。