alamofire

IPv6 App Store Rejection

百般思念 提交于 2019-11-26 19:36:21
Our update has been rejected twice today for ipv6 network connectivity issues. Our networking code has not changed between the previous release and this current release. The app only makes https network requests to api.metooapp.io, which is correctly configured for ipv6 [ 0 ] and runs behind route53 on AWS. There are no hard-coded IP addresses in the code. I am unable to reproduce this issue, even after following the steps to create an ipv6 network at [ 1 ] which is the link that was provided in the rejection notice. It looks like I'm not the only one experiencing this issue, either [ 2 ].

Swift. Could not build objective-c module 'Alamofire'

本秂侑毒 提交于 2019-11-26 19:13:14
问题 Fresh vanilla submodule install of Alamofire, using XCode6 and following directions to a T. Something here just isn't fitting right. The error i'm getting is "Could not build objective-c module "alamofire" on import alamofire. Here is a screen shot of the error i'm getting: And my configuration: 回答1: When this happens, just build the frameworks separately first. In your case: Change the scheme to Alamofire Build ( ⌘B ) Change back to your scheme Run 回答2: Go into Developer/Xcode/DerivedData

how to use Alamofire with custom headers

泪湿孤枕 提交于 2019-11-26 18:54:57
问题 I am just starting to take a look at Mattt's wonderful new Alamofire swift networking library and am not quite sure how one would use it with custom headers. The code i am trying to convert from AFNetworking to Alamofire is this: let request = NSMutableURLRequest(URL: url) request.setValue(authorizationToken, forHTTPHeaderField:"Authorization") 回答1: According to the official documentation, modifying the session configuration is not recommended: This is not recommended for Authorization or

upload image to server using Alamofire

别来无恙 提交于 2019-11-26 18:50:48
this is my code that I want to upload image to server using Alamofire, it not error but it can't push image to server. what should I do ? Thank in advance. let url = URL(string: urlString)! var urlRequest = URLRequest(url: url) urlRequest.httpMethod = "POST" let parameters = ["name": rname] do { urlRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: []) } catch { print(error) } urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") let image = UIImage.init(named: "myImage") let imgData = UIImageJPEGRepresentation(image!, 0.2)! Alamofire

Alamofire: finished with error - code: -1001

旧城冷巷雨未停 提交于 2019-11-26 18:35:12
问题 Code like this: import Foundation import Alamofire struct Request { var alamoFireManager : SessionManager? init() { let configuration = URLSessionConfiguration.default configuration.timeoutIntervalForRequest = 20 configuration.requestCachePolicy = .useProtocolCachePolicy alamoFireManager = Alamofire.SessionManager(configuration: configuration) } func sendRequest() { alamoFireManager?.request(url,method: method, parameters: body, encoding: JSONEncoding.default,headers: headers).responseJSON {

Chain multiple Alamofire requests

我怕爱的太早我们不能终老 提交于 2019-11-26 18:20:44
I'm looking for a good pattern with which I can chain multiple HTTP requests. I want to use Swift, and preferrably Alamofire . Say, for example, I want to do the following: Make a PUT request Make a GET request Reload table with data It seems that the concept of promises may be a good fit for this. PromiseKit could be a good option if I could do something like this: NSURLConnection.promise( Alamofire.request( Router.Put(url: "http://httbin.org/put") ) ).then { (request, response, data, error) in Alamofire.request( Router.Get(url: "http://httbin.org/get") ) }.then { (request, response, data,

Alamofire with a self-signed certificate / ServerTrustPolicy

天涯浪子 提交于 2019-11-26 18:18:03
问题 I want to use Alamofire to communicate with my server over a https connection with a self signed certificate. My environment runs on localhost. I've tried to connect, but the response all the time looks like this: Success: false Response String: nil I've done it with the following code: import Foundation import UIKit import Alamofire class MessageView: UITableViewController { let defaultManager: Alamofire.Manager = { let serverTrustPolicies: [String: ServerTrustPolicy] = [ "localhost":

POST request with a simple string in body with Alamofire

别来无恙 提交于 2019-11-26 17:13:12
how is it possible to send a POST request with a simple string in the HTTP body with Alamofire in my iOS app? As default Alamofire needs parameters for a request: Alamofire.request(.POST, "http://mywebsite.com/post-request", parameters: ["foo": "bar"]) These parameters contain key-value-pairs. But I don't want to send a request with a key-value string in the HTTP body. I mean something like this: Alamofire.request(.POST, "http://mywebsite.com/post-request", body: "myBodyString") Your example Alamofire.request(.POST, "http://mywebsite.com/post-request", parameters: ["foo": "bar"]) already

Swift closure with Alamofire

拥有回忆 提交于 2019-11-26 16:37:15
问题 I am making API calls to a server. I am leveraging Alamofire to handle this. I'm trying to create a function that uses Alamofire's GET function to return an object based on a custom class that holds the various outputs provided by this GET function. It's not clear to me the way in which to do this. Here's my custom class that will hold details about the response: import Foundation class ResponsePackage { var success = false var response: AnyObject? = nil var error: NSError? = nil } In another

“No such module 'Alamofire'” Xcode won't recognize Alamofire framework

拈花ヽ惹草 提交于 2019-11-26 16:36:07
问题 I realize that the same error was asked in other questions (like here), but their solutions are not working for me. I keep getting a build failure in my app: "No such module 'Alamofire'". I followed the cocoadocs installation instructions (here) for installing Alamofire and it still is not working. I made sure everything has the same deployment target. Embedded Binaries and Frameworks Here's my podfile text. source 'https://github.com/CocoaPods/Specs.git' platform :ios, ‘9.2’ use_frameworks!