Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 尽管提供了Twitter Api,但未批准回调url_Swift_Firebase_Twitter_Twitter Oauth - Fatal编程技术网

Swift 尽管提供了Twitter Api,但未批准回调url

Swift 尽管提供了Twitter Api,但未批准回调url,swift,firebase,twitter,twitter-oauth,Swift,Firebase,Twitter,Twitter Oauth,在twitter控制台中,我有一个链接到firebase的回调url。然而,当我尝试使用twitter进行身份验证时,我得到了一个错误: "Request failed: forbidden (403)" UserInfo={NSLocalizedFailureReason=Twitter API error : <?xml version="1.0" encoding="UTF-8"?><errors><error code="415">Callback U

在twitter控制台中,我有一个链接到firebase的回调url。然而,当我尝试使用twitter进行身份验证时,我得到了一个错误:

"Request failed: forbidden (403)" UserInfo={NSLocalizedFailureReason=Twitter API error : <?xml version="1.0" encoding="UTF-8"?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors> (code (null))
“请求失败:禁止(403)”UserInfo={NSLocalizedFailureReason=Twitter API错误:此客户端应用程序未批准回调URL。可在应用程序设置中调整批准的回调URL(代码(null))

怎么回事?我什么都试过了,除了我,互联网上似乎没有其他人有这个问题?

以下是对我有效的方法。我使用了twitters GitHub上提供的常规旧twitter工具包(用于swift和objective c):

这解决了我回拨url的问题(我最初使用的是Alamofire)

这是一个很好的无错误网络呼叫示例:

 let client = TWTRAPIClient()
    let statusesShowEndpoint = "https://api.twitter.com/1.1/users/show.json"

    var clientError : NSError?

    let request = client.urlRequest(withMethod: "GET", urlString: statusesShowEndpoint, parameters: ["user_id": "\(currentProfileTwitterUid)"], error: &clientError)

    client.sendTwitterRequest(request) { (response, data, connectionError) -> Void in
        if connectionError != nil {
            print("Error: \(String(describing: connectionError))")
        }

        do {
            if let json = try JSONSerialization.jsonObject(with: data!, options: []) as? Any{

            if let dict = json as? [String : Any]{
                //print(json)


            }
            }



        } catch let jsonError as NSError {
            print("json error: \(jsonError.localizedDescription)")
        }
    }

希望这对其他人有帮助!

我面临同样的问题,我们不需要在代码方面进行更改,我们只需要更改twitter(测试解决方案)开发者帐户中的一些设置。

您需要使用以下格式在回调URL中添加消费者/api键

参考链接:

twitterkit-消费者/api密钥://

您需要在info.plist

<array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>twitterkit-your Consumer Key (API Key)</string>
            </array>
        </dict>
    </array>

CbundleTypeRole
编辑
循环流化床锅炉方案
twitterkit用户密钥(API密钥)

我今天也面临着这个问题。你检查过这个吗?更新..问题解决为我,我只是按照我之前给出的链接。在Twitter的策略更新之后,我遇到了类似的问题。应该被接受为正确答案。@Zack。如果答案解决了你的问题,你能接受答案吗?谢谢