Strongloop iOS用户创建错误 [英] Strongloop iOS User Creation Error

查看:96
本文介绍了Strongloop iOS用户创建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码在服务器中创建并保存测试用户:

I'm trying to create and save a test user in server with this code:

LBRESTAdapter *adapter = ((AppDelegate *)[[UIApplication sharedApplication] delegate]).adapter;
    if (adapter) {
            TeacherRepository *repo = (TeacherRepository *)[adapter repositoryWithClass:[TeacherRepository class]];
            if (repo) {
                Teacher *st = (Teacher *)[repo createUserWithEmail:@"test@test.com" password:@"test"];
                if (st) {
                    [st saveWithSuccess:^{
                        NSLog(@"Saved in server!");
                    } failure:^(NSError *error) {
                        NSLog(@"Error: %@", error.description);
                    }];
                }
            }
       }

但我一直在继续错误响应:

but I keep on getting this error response:

Error Domain=AFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 404"

我已经搜索了此错误和其他类似错误,但是找不到任何可以解决我的问题的方法,

I have searched for this error and similar others, but couldn't find anything that would solve my problem, so what could be causing this?

推荐答案

HTTP状态代码(即404)表示找不到资源:

The HTTP Status Code of 404 means that the resource was not found:


找不到404


服务器未找到与Request-URI匹配的任何内容。没有迹象表明这种情况是暂时的还是永久的。如果服务器通过某种内部可配置的机制得知旧资源永久不可用并且没有转发地址,则应使用410(已消失)状态代码。当服务器不希望确切显示拒绝请求的原因或没有其他响应可用时,通常使用此状态代码。

404 Not Found

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

它似乎表明您的AFNetworking代码中的URL构建错误。您尚未共享那部分代码,因此很难在细节上发表评论。我认为,如果您记录整个 error 对象(而不仅仅是 error.description ),它将向您显示尝试的URL使用失败。

It would appear that there is an error in the building of the URL in your AFNetworking code. You haven't shared that portion of code, so it's hard to comment on the specifics. I think if you log the entire error object (not just error.description) it will show you what URL it attempted to use unsuccessfully.

这篇关于Strongloop iOS用户创建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆