草庐IT

Alamofire-SwiftyJson

全部标签

ios - 在 Alamofire 中更改 timeoutIntervalForRequest 的正确方法

我将timeoutIntervalForRequest更改为letmanager=Alamofire.SessionManager.defaultmanager.session.configuration.timeoutIntervalForRequest=3manager.request(url).response{}但似乎没有用,有什么建议吗? 最佳答案 这对我有用:)letconfiguration=URLSessionConfiguration.defaultconfiguration.timeoutIntervalForR

ios - 发布方法请求 Alamofire

我正在使用Swift3和Alamofire4.0。我想创建与屏幕截图中所示的Postman请求类似的AlamofirePOST请求:我试过这些代码行:varparameters:[String:Any]=["client_id":"xxxxxx","client_secret":"xxxxx","device_token":"xxxx","fullname":"xxxxx","gender":"xxx"]Alamofire.request(url,method:.post,parameters:parameters).responseJSON{responseinprint(respo

ios - 使用 Alamofire 返回对象数组

在我的应用程序中,我使用的是AlamofireObjectMapper。我想制作一个返回对象数组的方法。在Alamofire的帮助下,我发出了一个GET请求,它以responseArray的形式给出了响应。使用void函数数组listOfType总是有值。但是,当我使用应返回对象数组MedicineType的非void函数时,数组listOfType为nil。所以这是我的代码。funcgetAll()->[MedicineType]{varlistOfTypes:[MedicineType]?;Alamofire.request(BASE_URL,method:.get).respon

ios - 在同一个项目中使用 Alamofire 和 AlamofireImage

是否有在同一个项目中同时使用Alamofire和AlamofireImage的最佳方式?我在我制作的大多数项目中都使用Alamofire,我非常喜欢“新的”AlamofireImage框架,它使用Alamofire本身作为子模块。如果我在我的项目中将这两个框架作为sibling使用,那么我最终会得到多个版本的Alamofire、重复的方案等。出于几个原因,我想将它们作为sibling使用。AlamofireImage并不总是运行最新版本的Alamofire。在向Carthage开发人员询问了一些问题后,他们建议不要使用嵌套框架。https://github.com/Carthage/C

c# - 如何使用 Alamofire POST 请求将图像作为 Base64String 发送以及如何在 Asp.net MVC4 web Api Controller 中处理请求?

iOS新手,我的项目使用Alamofire(3.0.0)作为后端asp.netMVC4webApi。我已经通过这种方式将我的图像转换为base64stringswift2.0varuserProfileImage:String=""funcimagePickerController(picker:UIImagePickerController,didFinishPickingMediaWithInfoinfo:[String:AnyObject]){iflet_image=info["UIImagePickerControllerEditedImage"]as?UIImage//ifl

ios - 409 是 Alamofire 的成功吗?

在实现基于Alamofire的网络时,我遇到了一件奇怪的事情。所以,我的后端可以返回409,当我得到它时,我想做出正确的react,所以我选择了一个常规解决方案:Alamofire.request(someRequest).responseJSON{responseinswitchresponse.result{case.Success(letvalue)://Iget409here...ifresponse.response?.statusCode==409{//...}case.Failure(leterror)://Whileitshouldbehere...}}为什么会这样?这

Alamofire .Dowload需要很多记忆(iOS,Swift)

我使用Alamofire框架从服务器下载了图像。我与Alamofire.Download合作。每个图像的大小都高于1MB+-,但是在每个请求之后,内存都会增加很多。下载4张图像后,所使用的内存高于171MB,此后每个图像给出超过35MB。下载代码是:Alamofire.download(mainReguest,to:self.destination).downloadProgress{progressinself.progressView.progress=Float(progress.fractionCompleted)}.response{responseinifresponse.erro

alamofire额外的争论

从过去2天开始面对这个问题。我已经更新了POD,从4.0.1至4.5.0但是问题仍然相同。这是我的代码:varparams:Parameters=[:]params=["id":fetchFromCoreData(keyVlue:"trsptrRegistrationId")asAnyObject,"mobileNumber":fetchFromCoreData(keyVlue:"mobileNO")asAnyObject,"isNotification":isnotifyTagasAnyObject]print(params)letauth_token=fetchFromCoreData(k

Swift Alamofire映射器

SwiftAlamofireMapper不会用null映射字符串数组。例如,我们有:["first_item","second_item",null]当我使用Alamofire映射器时,它将返回空数组,例如->[],当我们这样的服务响应时,如何处理数组中的空值?谢谢!看答案最后,我找到了如何弄清楚的:)我的模型就像波纹管:importObjectMapperstructDataItems:Mappable{varrulesUrl:String?varisAvailable:Bool?varcompanyName:String?varoffers:[String]?requiredinit

ios - ld : framework not found Alamofire

我花了几天时间尝试解决这个问题,现在我的想法已经用完了。我有:Xcodev8.2.1AppleSwift版本3.0.2(swiftlang-800.0.63clang-800.0.42.1)cocoapods-1.2.0我正在创建新的Xcode项目(单View应用程序),选择清理和构建-一切都很顺利。在根项目路径中的podinit之后,我正在编辑我的Podfile,如下所示:#Uncommentthenextlinetodefineaglobalplatformforyourproject#platform:ios,'9.0'source'https://github.com/Coco