How does one insert a row into a table that I've created with two sqlserver smalldatetime fields via the windows azure mobile services library? I'm currently trying to use:

[NSDate timeIntervalSince1970]

to store the date-time value as an NSTimeInterval or double. However, this causes the following error:

Error Domain=com.Microsoft.WindowsAzureMobileServices.ErrorDomain Code=-1302 "Error: Bad request." 
有帮助吗?

解决方案

DateTime fields should be represented by an NSDate field in the NSDictionary object you are sending to insert or update call.

So you would just do:

[table insert:@{ @"id": @"myid", @"deliveryDate": [NSDate date] } completion:... ];

If you send an NSNumber instead, then you would see the -1302 error shown above.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top