ios - MSSyncTable insert -


i have dictionary dict, info

(lldb) po dict { createdat = "2016-05-25 06:29:16 +0000"; deleted = 0; diskid = "f54b4bd9-694b-4856-8b8f-7f3afa18fd2e"; updatedat = "2016-05-25 06:29:16 +0000"; userid = "4f119c15-2370-4ad7-bcbc-2cd4254b356e"; version = "1.0"; } 

i call mssynctable insert function:

-(void)insert:(nonnull nsdictionary *)item completion:(nullable mssyncitemblock)completion; 

the info saved local db successfully, on mobile service side, received object don't have info version , updatedat , createdat, null, mobile service return error ios app below:

"{\"message\":\"the operation failed following error: 'a null store-generated value returned non-nullable member 'version' of type 'saveonpayservice.models.sopuserstoresfavorite'.'.\"}"), nslocalizeddescription=not operations completed successfully} 

is there know what's going on here?

update: server side code like

public async task<ihttpactionresult> posttodoitem(todoitem item)     {         todoitem current = await insertasync(item);         return createdatroute("tables", new { id = current.id }, current);     } 

do need set createdat, updateat , version here?

updated: console output in mobile service side:

w3wp.exe information: 0 : message='exbenstoresfavorite', operation=defaulthttpcontrollerselector.selectcontroller w3wp.exe information: 0 : message='exbenservice.controllers.exbenstoresfavoritecontroller', operation=defaulthttpcontrolleractivator.create w3wp.exe information: 0 : message='exbenservice.controllers.exbenstoresfavoritecontroller', operation=httpcontrollerdescriptor.createcontroller w3wp.exe information: 0 : message='selected action 'postexbenstoresfavorite(exbenstoresfavorite item)'', operation=apicontrolleractionselector.selectaction w3wp.exe information: 0 : message='value read='exbenservice.models.exbenstoresfavorite'', operation=jsonmediatypeformatter.readfromstreamasync w3wp.exe information: 0 : message='parameter 'item' bound value 'exbenservice.models.exbenstoresfavorite'', operation=formatterparameterbinding.executebindingasync w3wp.exe information: 0 : message='model state valid. values: item=exbenservice.models.exbenstoresfavorite', operation=httpactionbinding.executebindingasync w3wp.exe information: 0 : operation=tablequeryfilter.onactionexecutingasync w3wp.exe information: 0 : operation=tablecontrollerconfigattribute.onactionexecutingasync w3wp.exe information: 0 : message='will use same 'jsonmediatypeformatter' formatter', operation=jsonmediatypeformatter.getperrequestformatterinstance w3wp.exe information: 0 : message='selected formatter='jsonmediatypeformatter', content-type='application/json; charset=utf-8'', operation=defaultcontentnegotiator.negotiate w3wp.exe error: 0 : message='the operation failed following error: 'a null store-generated value returned non-nullable member 'version' of type 'exbenservice.models.exbenstoresfavorite'.'.' w3wp.exe warning: 0 : message='usermessage='the operation failed following error: 'a null store-generated value returned non-nullable member 'version' of type 'exbenservice.models.exbenstoresfavorite'.'.'', status=400 (badrequest), exception=system.web.http.httpresponseexception: processing of http request resulted in exception. please see http response returned 'response' property of exception details. @ microsoft.azure.mobile.server.tables.entityutils.d__0.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.azure.mobile.server.entitydomainmanager1.<insertasync>d__0.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.azure.mobile.server.tablecontroller1.d__3.movenext() exception thrown: 'system.web.http.httpresponseexception' in mscorlib.dll

if trying map fields updatedat, createdat , version system properties, need use names ms_createdat, ms_updatedat , ms_version. note these cannot set on client, set on server side , returned client after push operation. learn more core data model need use, see get started offline data sync in mobile services.

also, in debugging, recommend log outgoing requests ios client. see log outgoing requests in ios native client. should log both request , response, , see if system properties being returned server.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -