菜鸟教程小白 发表于 2022-12-13 05:07:47

在 Quickblox 中更新时 ios 无法处理的实体


                                            <p><p>我正在开发一个聊天应用程序,并添加了用于聊天的 Quickblox 框架,但是在用户更新时出现以下错误:</p>

<blockquote>
<p>Request URL:<a href="https://api.quickblox.com/users/12345.json?user%5Bemail%5D=abc%40gmail.com&amp;user%5Bfull_name%5D=abc%xyz&amp;user%5Blogin%5D=1234567890&amp;user%5Bpassword%5D=abcdefghij&amp;user%5Bphone%5D=1234567890" rel="noreferrer noopener nofollow">https://api.quickblox.com/users/12345.json?user%5Bemail%5D=abc%40gmail.com&amp;user%5Bfull_name%5D=abc%xyz&amp;user%5Blogin%5D=1234567890&amp;user%5Bpassword%5D=abcdefghij&amp;user%5Bphone%5D=1234567890</a></p>

<p>Request method: PUT</p>

<p>Request headers: {
      &#34;Content-Type&#34; = &#34;application/json&#34;;
      &#34;QB-SDK&#34; = &#34;iOS 2.0.12&#34;;
      &#34;QB-Token&#34; = b9a57f30857d7591d6766dac7345d78bc1c9f588;
      &#34;QuickBlox-REST-API-Version&#34; = &#34;0.1.1&#34;;
}
Request parameters:{
      user =   {
          email = &#34;[email protected]&#34;;
          &#34;full_name&#34; = &#34;abc xyz&#34;;
          login = 1234567890;
          password = abcdefghij;
          phone = 1234567890;
      };
}</p>

<p>Request headers: {
      &#34;Content-Type&#34; = &#34;application/json&#34;;
      &#34;QB-SDK&#34; = &#34;iOS 2.0.12&#34;;
      &#34;QB-Token&#34; = b9a57f30857d7591d6766dac7345d78bc1c9f588;
      &#34;QuickBlox-REST-API-Version&#34; = &#34;0.1.1&#34;;
}</p>

<p>Response headers: {
      &#34;Access-Control-Allow-Origin&#34; = &#34;*&#34;;
      &#34;Cache-Control&#34; = &#34;no-cache&#34;;
      Connection = &#34;keep-alive&#34;;
      &#34;Content-Type&#34; = &#34;application/json; charset=utf-8&#34;;
      Date = &#34;Sun, 01 Feb 2015 18:59:19 GMT&#34;;
      &#34;QB-Token-ExpirationDate&#34; = &#34;2015-02-01 20:57:39 UTC&#34;;
      &#34;QuickBlox-REST-API-Version&#34; = &#34;0.1.1&#34;;
      Server = &#34;nginx/1.0.15&#34;;
      Status = &#34;422 Unprocessable Entity&#34;;
      &#34;Transfer-Encoding&#34; = Identity;
      &#34;X-Rack-Cache&#34; = &#34;invalidate, pass&#34;;
      &#34;X-Request-Id&#34; = 17331b69e1b7a38d8545629e241733c8;
      &#34;X-Runtime&#34; = &#34;0.013145&#34;;
      &#34;X-UA-Compatible&#34; = &#34;IE=Edge,chrome=1&#34;;
}</p>
</blockquote>

<p>我使用了以下代码...</p>

<pre><code>    if (firstName.length &gt; 0 || lastName.length &gt; 0 || email.length &gt; 0 || mobileNo.length &gt; 0 || country.length &gt; 0) {

    QBUUser *user = ;
    AppUser *AppUser = ;
    user.ID = AppUser.ID;
    user.login = AppUser.login;
    user.password = AppUser.password;
    user.fullName = ;
    user.email = email;
    user.phone = mobileNo;

    [QBRequest updateUser:user
             successBlock:^(QBResponse *response, QBUUser *user) {

      AppUser *AppUser = ;
      AppUser.country = country;

      UIAlertView *alertView = [ initWithTitle:@&#34;Information&#34; message:@&#34;Profile updated successfully.&#34; delegate:nil cancelButtonTitle:@&#34;OK&#34; otherButtonTitles:nil];
      ;

    } errorBlock:^(QBResponse *response) {

      UIAlertView *alertView = [ initWithTitle:@&#34;Error&#34; message:@&#34;Error while updating.&#34; delegate:nil cancelButtonTitle:@&#34;OK&#34; otherButtonTitles:nil];
      ;

    }];
} else {

    UIAlertView *alertView = [ initWithTitle:@&#34;Information&#34; message:@&#34;Fields can&#39;t be empty.&#34; delegate:nil cancelButtonTitle:@&#34;OK&#34; otherButtonTitles:nil];
    ;
}
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>首先尝试通过删除(或注释掉)上述字段之一来更新用户对象,直到找到有问题的属性。您一次更新了这么多,以至于您不知道是哪一个导致了问题。</p>

<p>我怀疑登录属性是来源,因为我相信它是在注册时设置和修复的,因此之后无法更新。</p></p>
                                   
                                                <p style="font-size: 20px;">关于在 Quickblox 中更新时 ios 无法处理的实体,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/28267386/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/28267386/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: 在 Quickblox 中更新时 ios 无法处理的实体