alamofire

Swift 2.0, Alamofire: Set cookies in HTTP Post Request

冷暖自知 提交于 2019-12-03 12:27:08
I want to set cookies in my HTTP POST request. Something like the cookie field in the HTTP Request below, version: 0.1.7 Cookie: client=Android; version=0.1.7; sellerId=SEL5483318784; key=178a0506-0639-4659-9495-67e5dffa42de Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Content-Length: 1431 How can I achieve this with Alamofire? My current Alamofire request is like this, Alamofire.request(.POST, ServerConfig.ADD_PRODUCT_URL, parameters: productJSON, encoding: .JSON, headers: nil) .responseJSON(completionHandler: { responseRequest, responseResponse, responseResult in print

Alamofire loading from cache even when cache policy set to ReloadIgnoringLocalAndRemoteCacheData

不问归期 提交于 2019-12-03 10:51:07
I set cache policy to request in Alamofire to ignore local cache. Then I load a viewcontroller with network connection, then I disconnect network connection, kill the app and run it again. Now no network available error is not shown(ie alamofire doesnt create nserror object) created, instead app runs as if the request succeeded getting data from cache obviously.And the odd thing is the when I tried to inspect the cached data using NSURLCache.sharedURLCache().cachedResponseForRequest(request) nil is returned eventhough the data was from cache .. The only way I could prevent cached responses is

Failed to load Info.plist from bundle

Deadly 提交于 2019-12-03 10:24:57
问题 Cannot run app. Failed to load Info.plist from bundle error occurs. When I CMD+K clean the project, it runs fine. But I have to clean the project every time I make changes and run the app. Following is the screenshot of my podfile: 回答1: I had tried all suggestion and none of them work Then I tried to Reset content and Setting of simulator and it worked for me. :) 回答2: Simply Just quit the simulator and open it again and it should works fine 回答3: 1: Remove app from simulator, 2: Product >

Importing Alamofire 3.4 - No such module 'Alamofire'

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I hava a project that need Alamofire imported and every aproach i took got me to same porblem import Alamofire - No such module 'Alamofire' Installed cocoapods Edited Podfile: source ' https://github.com/CocoaPods/Specs.git ' platform : ios , '9.0' use_frameworks ! target 'my project name' do pod 'Alamofire' , '~> 3.4' end $ pod install everything was smooth and had no errors in the proces from installing cocoapods to the end. Opened project with projectname.xcworkspace Even tried the manually and still the same problem - No such

Error Domain=com.alamofire.error.serialization.response Code=-1011 “Request failed: internal server error (500)”

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using afnetworking in my application. To post data on server I wrote following code - (void) callLoginAPI:(NSDictionary *)dictProfile{ // 1 NSDictionary *params = @{@"username":[dictProfile valueForKey:@"name"], @"first_name":[dictProfile valueForKey:@"first_name"], @"last_name":[dictProfile valueForKey:@"last_name"], @"email":[dictProfile valueForKey:@"email"], @"dob":[dictProfile valueForKey:@"birthday"], @"gender":[dictProfile valueForKey:@"gender"], @"location":[[dictProfile valueForKey:@"location"] valueForKey:@"name"], @"timezone"

Alamofire download issue

删除回忆录丶 提交于 2019-12-03 08:40:35
问题 I am trying to download this picture in my code using Alamofire 4.0.0 with Xcode 8.0 and Swift 3.0. Here is my request: func download(_ path: String, _ completionHandler: @escaping (Any?) -> ()) { let stringURL = "https://slove.tulleb.com/uploads/6/6/0/2/66027561/2791411.jpg-1447979839.png" print("Requesting \(stringURL)...") _ = Alamofire.download(stringURL) .responseData { response in print(response) if let data = response.result.value { completionHandler(UIImage(data: data)) } else {

Cancelling an Alamofire Request Wrapped In NSOperation Causes Multiple KVO?

戏子无情 提交于 2019-12-03 08:40:30
My Xcode version: 6.3.2 Alamofire version: 1.2.2 (installed via Cocoapods) In order to set maxConcurrentOperationCount to limit the concurrent operation number in a NSOperationQueue , I wrap my Alamofire download request in a NSOperation just like Rob suggested . The basic subclass of NSOperation like this: class ConcurrentOperation : NSOperation { override var concurrent: Bool { return true } override var asynchronous: Bool { return true } private var _executing: Bool = false override var executing: Bool { get { return _executing } set { if (_executing != newValue) { self

Alamofire framework not found

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to install alamofire into my project so I can upload images to my server, however I cannot seem to find the alamofire.framework file. I have downloaded the git twice, done the installation instructions on https://github.com/Alamofire/Alamofire but when it comes to step 6 , how and where do I get the alamofire.framework file? I am new to this, so sorry if it is a stupid question. 回答1: You have to open yourprojectname.xcworkspace You might get this error if you are opening your .xcworkproj instead of workspace 回答2: Close your Xcode

Alamofire returns .Success on error HTTP status codes

不羁岁月 提交于 2019-12-03 08:22:20
问题 I have a pretty simple scenario that I'm struggling with. I'm using Alamofire to register a user on a rest API. The first call to register is successful and the user can log in. The second call, when trying to register with the same email address should result in a HTTP status code 409 from the server. Alamofire, however, returns a .Success with an empty request and response. I have tested this this API with postman and it correctly returns a 409. Why is Alamofire not returning .Failure(error

Importing Alamofire in Project that targets iOS 7

大憨熊 提交于 2019-12-03 07:31:25
I checked the new Alamofire installation steps. Since I need to target iOS 7.0 I wonder if importing the Alamofire.swift is enough to make it works or not? Why the documentation states to wrap the functions around a Struct Alamofire ? is that needed to call functions as they were within a Namespace? and in that case have I to wrap the whole file or single functions? You just have to add this: //put this on alamofire.swift, then call it as Alamofire.manager.your_method struct Alamofire { static let manager = Manager.sharedInstance } And after you can use on this way: Alamofire.manager.request(