質問

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