首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >INPUT_VALIDATION_ERROR in BetFair Login / iOS

INPUT_VALIDATION_ERROR in BetFair Login / iOS
EN

Stack Overflow用户
提问于 2016-08-03 11:53:17
回答 1查看 1.6K关注 0票数 1

当我登录到betfair时,我得到了INPUT_VALIDATION_ERROR。我正在跟踪这些文档,但是对于这个特定的错误代码来说,这是没有用的。

如果有人能引导我朝正确的方向前进,我将不胜感激。

这是我的快速密码

代码语言:javascript
复制
let request = NSMutableURLRequest(URL: NSURL(string: "https://identitysso.betfair.com/api/login")!)
        request.HTTPMethod = "POST"


                request.setValue("application/json", forHTTPHeaderField: "Accept")
        request.setValue("MY_APP_KEY", forHTTPHeaderField: "X-Application")


        let postString = "username=MY_USER_NAME&password=MY_PASSWORD"
        request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding)

        let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { data, response, error in
            guard error == nil && data != nil else {                                                          // check for fundamental networking error
                print("error=\(error)")
                return
            }

            if let httpStatus = response as? NSHTTPURLResponse where httpStatus.statusCode != 200 {           // check for http errors
                print("statusCode should be 200, but is \(httpStatus.statusCode)")
                print("response = \(response)")
            }

            let responseString = NSString(data: data!, encoding: NSUTF8StringEncoding)
            print("responseString = \(responseString)")
        }
        task.resume()
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-04 11:00:55

我认为您需要将Content-Type的头设置为

代码语言:javascript
复制
application/x-www-form-urlencoded

Http头中的三个参数:

代码语言:javascript
复制
    httpRequest.setHeader("Accept", "application/json");
    httpRequest.setHeader("Content-Type", "application/x-www-form-urlencoded");
    httpRequest.setHeader("X-Application", <apiKey>);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38742866

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档