NSDate *future = [NSDate dateWithString:@"2010-12-25 00:00:00 -0600"];
Dostaję komunikat ostrzegawczy: NSDate
może nie reagować na +dateWithString
'NSDate' może nie reagować na + dateWithString
Jakieś pomysły?
NSDate *future = [NSDate dateWithString:@"2010-12-25 00:00:00 -0600"];
Dostaję komunikat ostrzegawczy: NSDate
może nie reagować na +dateWithString
'NSDate' może nie reagować na + dateWithString
Jakieś pomysły?
może masz na myśli metodę w NSDateFormatter?
NSDate dateFromString to tylko MacOS, a nie iOS.
Skąd to wiesz? Dokumenty, na które patrzę, nawet nie wspominają o systemie iOS, tylko OSX. https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html#//apple_ref/occ/clm/NSDate/dateWithString: – ericsoco
@ericsoco, spróbuj [Odwołanie do klasy NSD dla systemu iOS] (http://developer.apple.com/library/ios/#documentation/cocoa/reference/foundation/Classes/NSDate_Class/Reference/Reference.html). – JohnK
Nawet bez otwierania adresu URL widać, że ten dokument nie jest przeznaczony dla systemu iOS. A jeśli zajrzysz do środka ... "Dostępność: Dostępne w systemie OS X w wersji 10.0 i nowszych" –
Mam to. NSString * dateString = @ "25-Dec-10"; \t \t NSDateFormatter * dateFormatter = [[[NSDateFormatter Alloc] startowych] autorelease]; \t dateFormatter.dateFormat = @ "dd-MMM-yy"; \t \t NSDate * przyszłości = [dateFormatter dateFromString: datestring]; –