iOS 9上的Alamofire 1.3

iOS 9上的Alamofire 1.3,ios,xcode,ios9,alamofire,Ios,Xcode,Ios9,Alamofire,似乎没有在iOS 9上设置身份验证标头。我们无法更新到Alamofire 2.0,因为我们尚未将代码迁移到Swift 2。还有其他人遇到过这个问题吗?我也遇到了同样的问题,因为我通过会话配置管理器放置了如下标题: Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", forKey: "Author

似乎没有在iOS 9上设置身份验证标头。我们无法更新到Alamofire 2.0,因为我们尚未将代码迁移到Swift 2。还有其他人遇到过这个问题吗?

我也遇到了同样的问题,因为我通过会话配置管理器放置了如下标题:

Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", forKey: "Authorization")
Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("application/x-www-form-urlencoded", forKey: "Content-Type")
它在ios8上运行得很好,但在iOS9上却一事无成。我没有注意到,您也可以在发出请求时直接设置标题:

let headers = [
    "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "Content-Type": "application/x-www-form-urlencoded"
]

Alamofire.request(.GET, "http://httpbin.org/get", headers: headers)
         .responseJSON { _, _, JSON, _ in
             println(JSON)
         }

现在,它对我来说很好。

我也遇到了同样的问题,因为我通过会话配置管理器放置了如下标题:

Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", forKey: "Authorization")
Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("application/x-www-form-urlencoded", forKey: "Content-Type")
它在ios8上运行得很好,但在iOS9上却一事无成。我没有注意到,您也可以在发出请求时直接设置标题:

let headers = [
    "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "Content-Type": "application/x-www-form-urlencoded"
]

Alamofire.request(.GET, "http://httpbin.org/get", headers: headers)
         .responseJSON { _, _, JSON, _ in
             println(JSON)
         }

现在,它对我来说很好。

我也遇到了同样的问题,因为我通过会话配置管理器放置了如下标题:

Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", forKey: "Authorization")
Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("application/x-www-form-urlencoded", forKey: "Content-Type")
它在ios8上运行得很好,但在iOS9上却一事无成。我没有注意到,您也可以在发出请求时直接设置标题:

let headers = [
    "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "Content-Type": "application/x-www-form-urlencoded"
]

Alamofire.request(.GET, "http://httpbin.org/get", headers: headers)
         .responseJSON { _, _, JSON, _ in
             println(JSON)
         }

现在,它对我来说很好。

我也遇到了同样的问题,因为我通过会话配置管理器放置了如下标题:

Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", forKey: "Authorization")
Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders?.updateValue("application/x-www-form-urlencoded", forKey: "Content-Type")
它在ios8上运行得很好,但在iOS9上却一事无成。我没有注意到,您也可以在发出请求时直接设置标题:

let headers = [
    "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "Content-Type": "application/x-www-form-urlencoded"
]

Alamofire.request(.GET, "http://httpbin.org/get", headers: headers)
         .responseJSON { _, _, JSON, _ in
             println(JSON)
         }
现在它对我来说很好。

使用此代码

    let headers = [
            "Authorization": userData.userAPIKey!,
        ]
    Alamofire.request(.GET, url, parameters: nil, encoding: .URL, headers:headers).response { (request, response, data, error) -> Void in
   }
使用此代码

    let headers = [
            "Authorization": userData.userAPIKey!,
        ]
    Alamofire.request(.GET, url, parameters: nil, encoding: .URL, headers:headers).response { (request, response, data, error) -> Void in
   }
使用此代码

    let headers = [
            "Authorization": userData.userAPIKey!,
        ]
    Alamofire.request(.GET, url, parameters: nil, encoding: .URL, headers:headers).response { (request, response, data, error) -> Void in
   }
使用此代码

    let headers = [
            "Authorization": userData.userAPIKey!,
        ]
    Alamofire.request(.GET, url, parameters: nil, encoding: .URL, headers:headers).response { (request, response, data, error) -> Void in
   }

这是我的示例代码,我以前也遇到过同样的问题。现在是决心

// Step : 1  
    var manager = Manager.sharedInstance

 // Specifying the Headers we need
 manager.session.configuration.HTTPAdditionalHeaders = [
    "Content-Type": "application/graphql",
    "Accept": "application/json" //Optional
    ]

 // Step : 3 then call the Alamofire request method.

Alamofire.request(.GET, url2).responseJSON { request, response,  result in
 print(result.value)
 }
试试这个,或者您可以在xcode 7上查看alamofire的最新更新:


这是我的示例代码,我以前也遇到过同样的问题。现在是决心

// Step : 1  
    var manager = Manager.sharedInstance

 // Specifying the Headers we need
 manager.session.configuration.HTTPAdditionalHeaders = [
    "Content-Type": "application/graphql",
    "Accept": "application/json" //Optional
    ]

 // Step : 3 then call the Alamofire request method.

Alamofire.request(.GET, url2).responseJSON { request, response,  result in
 print(result.value)
 }
试试这个,或者您可以在xcode 7上查看alamofire的最新更新:


这是我的示例代码,我以前也遇到过同样的问题。现在是决心

// Step : 1  
    var manager = Manager.sharedInstance

 // Specifying the Headers we need
 manager.session.configuration.HTTPAdditionalHeaders = [
    "Content-Type": "application/graphql",
    "Accept": "application/json" //Optional
    ]

 // Step : 3 then call the Alamofire request method.

Alamofire.request(.GET, url2).responseJSON { request, response,  result in
 print(result.value)
 }
试试这个,或者您可以在xcode 7上查看alamofire的最新更新:


这是我的示例代码,我以前也遇到过同样的问题。现在是决心

// Step : 1  
    var manager = Manager.sharedInstance

 // Specifying the Headers we need
 manager.session.configuration.HTTPAdditionalHeaders = [
    "Content-Type": "application/graphql",
    "Accept": "application/json" //Optional
    ]

 // Step : 3 then call the Alamofire request method.

Alamofire.request(.GET, url2).responseJSON { request, response,  result in
 print(result.value)
 }
试试这个,或者您可以在xcode 7上查看alamofire的最新更新:


@swift BUTCHER。。。你查过阿拉莫菲尔1.3了吗。如果是,请将代码粘贴到此处。@swift BUTCHER。。。你查过阿拉莫菲尔1.3了吗。如果是,请将代码粘贴到此处。@swift BUTCHER。。。你查过阿拉莫菲尔1.3了吗。如果是,请将代码粘贴到此处。@swift BUTCHER。。。你查过阿拉莫菲尔1.3了吗。如果是,则将代码粘贴到此处。。