Question

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." 
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top