ios - Azure iOS 移动客户端 : The server did not return the expected item

标签 ios node.js azure

我正在更新适用于 iOS 的 Microsoft Azure 移动服务的示例 Todo 应用程序,以使用表存储而不是默认的 MSSQL 后端。目前,当我尝试插入新项目时,我在客户端中收到以下错误:

2014-11-22 11:06:44.895 xxx[6942:869598] ERROR Error Domain=com.Microsoft.WindowsAzureMobileServices.ErrorDomain Code=-1201 "The server did not return the expected item." UserInfo=0x7a6b1040 {NSLocalizedDescription=The server did not return the expected item., com.Microsoft.WindowsAzureMobileServices.ErrorResponseKey=<NSHTTPURLResponse: 0x7a764cc0> { URL: https://xxx.azure-mobile.net/tables/TodoItem } { status code: 200, headers {
    "Cache-Control" = "no-cache";
    "Content-Encoding" = gzip;
    "Content-Length" = 126;
    "Content-Type" = "application/json";
    Date = "Sat, 22 Nov 2014 19:06:44 GMT";
    Server = "Microsoft-IIS/8.0";
    Vary = "Accept-Encoding";
    "X-Powered-By" = "ASP.NET";
    "x-zumo-version" = "Zumo.master.0.1.6.4100.Runtime";
} }, com.Microsoft.WindowsAzureMobileServices.ErrorRequestKey=<NSMutableURLRequest: 0x7a7797a0> { URL: https://xxx.azure-mobile.net/tables/TodoItem }}

我没有更改客户端代码。 https://github.com/Azure/azure-mobile-services/blob/master/sdk/iOS/src/MSJSONSerializer.m 处的文档表明此错误是“errorForExpectedItem”错误,并且会在 itemFromData:withOriginalItem:ensureDictionary:orError: 中抛出。

当我试图让 todoitem.read.js 脚本工作时,这个错误开始发生;到目前为止,我无法从该脚本中获取可用的实体。这是我现在的 todoitem.read.js:

var azure = require('azure-storage');
var tableSvc = azure.createTableService();


function read(query, user, request) {

    query = new azure.TableQuery()
      .select()
      .where('PartitionKey eq ?', 'learningazure');
    console.log('query: ', query);

    tableSvc.queryEntities('TodoItem',query, null, function(error, result, response) {
        if(!error) {
            // query was successful
            // add the count to the response dictionary
            response.count = response.body.value.length;
            response.results = result.entries;
            request.respond(200, response);
        } else {
            console.log('Error calling read()');
            console.log(error);
        }
    });

}

有什么建议吗?

最佳答案

德普。我的错误:在 todoitem.insert.js 中,在 insert() 函数中,我从未调用过 request.respond()。

现在 node.js 代码正在返回数据,但它仍然没有显示在 iOS 客户端中。需要更多阅读。

关于ios - Azure iOS 移动客户端 : The server did not return the expected item,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27081459/

相关文章:

ios - 使用自动布局时何时将 imageView 添加到 UIButton

iOs Swift Collection View dismissView

node.js - 处理Node.js中的错误

javascript - Youtube API 在 Node.js Express 中使用异步来处理多个相关请求

javascript - 查找 Mongo 集合,始终返回未定义

reactjs - Azure B2C 引发访问 token 验证失败。无效观众

c# - 如何在 C# 中使用 WebClient 将参数发布到 Azure 服务 URL

html - 移动设备只能部分显示网页

ios - 通过handleOpenURL将p12身份作为电子邮件附件导入应用程序

ruby - AzureRM 应用程序网关 Rest API