简体   繁体   中英

How to fix “not a valid AllXsd value” in objective-C?

I am trying to consume a web service by passing in a date time however I am getting the following:

The string '5/19/2010 5:25:21 PM' is not a valid AllXsd value.

Do I need to convert the string "5/19/2010 5:25:21 PM" to a meaningful object in objective C and if so how?

I think you seem to be sending the date in the wrong format. You need to send this in 2008-02-16T18:13:00 format. You can get that using a date formatter using,

NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
NSString * theDateString = [dateFormatter stringFromDate:[NSDate date]];

NSLog(@"%@", theDateString); 

Use this when you are building the request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM