草庐IT

Alamofire-SwiftyJSON

全部标签

ios - 错误域=com.alamofire.error.serialization.response 代码=-1011“请求失败 : bad request (400)

我正在使用AFnetworking库在服务器上发布数据。以下是我在服务器上发布数据的代码。-(void)callLoginAPI:(NSDictionary*)dictProfile{//1NSDictionary*params=[NSDictionarydictionaryWithObjectsAndKeys:[dictProfilevalueForKey:@"name"],@"username",[dictProfilevalueForKey:@"first_name"],@"first_name",[dictProfilevalueForKey:@"last_name"],@"l

ios - 错误域=com.alamofire.error.serialization.response 代码=-1011“请求失败 : forbidden

谁能帮我解决下面的错误-->在AFNetworking2.5中使用“删除”方法时出现错误ErrorDomain=com.alamofire.error.serialization.responseCode=-1011"Requestfailed:forbidden(403)"UserInfo=0x7fec59455ac0com.alamofire.serialization.response.error.response={URL:http://server.net:8081/api?JobId=4&UserId=13&X-API-KEY=89823424323432424khk234

ios - 使用 Alamofire 时出现 Heroku "Request Interrupted"错误

我正在使用Alamofire发出从在Heroku上运行的Rails应用程序返回JSON的HTTP请求。进行HTTPGET调用时,我在客户端收到此NSError:ErrorDomain=NSURLErrorDomainCode=-1005"Theoperationcouldn’tbecompleted(NSURLErrorDomainerror-1005.)"UserInfo=0x1700e6a00{NSErrorFailingURLStringKey=https://********.herokuapp.com/api/workouts.json,NSErrorFailingURLKe

ios - 无法在 iOS 中使用 SwiftyJson 将 JSON 数组或 JSON 对象分配给 JSON

我有一个JSON对象:varx:JSON=JSON([:])x["1"].intValue=1//Correctx["2"].arrayValue=[JSON("2")]//Errorx["3"].dictionaryValue=[3:JSON("3")]//Error我可以为x分配一个整数,但我无法分配任何JSON数组或任何JSON字典。我做错了什么,我该如何解决? 最佳答案 假设您最初想分配一个JSON对象数组://doesntworkx["1"].arrayObject=[JSON(["1":"2"]),JSON(["3":"

ios - Alamofire:如何获取部分响应 JSON

我有一个关于Alamofire的问题。我这样做:varmutableURLRequest=NSMutableURLRequest(URL:url!)mutableURLRequest.setValue(response!.allHeaderFields["TOKEN"]as!String,forHTTPHeaderField:"X-AUTH-TOKEN")mutableURLRequest.HTTPMethod="GET"letmanager=Alamofire.Manager.sharedInstance//orcreateanewoneletrequest=manager.requ

ios - 如何在 Swift 中使用 Alamofire 将正文参数与文件一起传递到多部分文件上传中

我正在使用Swift中的Alamofire库进行多部分文件上传。我需要随文件传递一些参数。以下是我需要传递给服务器的正文:{"eventId":7,"eventImageList":[{"contentType":"png","imageName":"test","imagePath":""},{"contentType":"png","imageName":"test2","imagePath":""}]}我试过类似的:letimage=UIImage(named:"sampleImage")Alamofire.upload(.POST,URL,multipartFormData:{

ios - Alamofire : Type of expression is ambiguous in . 获取

我正在尝试使用Alamofire框架进行简单的下载。就在我将下载代码粘贴到我的项目(swift2)中时,我在此Alamofire代码中收到此错误:Alamofire.download(.GET,"https://httpbin.org/stream/100",destination:destination).progress{bytesRead,totalBytesRead,totalBytesExpectedToReadinprint(totalBytesRead)//ThisclosureisNOTcalledonthemainqueueforperformance//reason

ios - 在使用 Alamofire + suggestedDownloadDestination 下载文件之前检查文件是否已经存在

如何在使用Alamofire重新下载之前检查给定文件是否已下载?我正在使用suggestedDownloadDestination,因此Alamofire会自动选择文件名并将其保存在所选目录中,例如.CachesDirectory。问题是suggestedDownloadDestination给出的值属于DownloadFileDestination类型,只有通过请求的响应调用他才会返回NSURL,但通过这种方式,如果之前不执行请求,我永远无法知道文件路径。这是我目前使用Alamofire下载文件的代码:Alamofire.download(.GET,downloadLink,dest

swift - 如何使用 alamofire 的多部分表单数据发送嵌套数组参数

如何将这个参数传给multipartletdictionary=["user":["email":"\(email!)","token":"\(loginToken!)"],"photo_data":["name":"TokoTokoan1","avatar_photo":photo,"background_photo":photo,"phone":"0222222222","addresses":[["address":"JalanKita","provinceid":13,"cityid":185,"postal":"45512"]],"banks":[["bank_name":"

ios - 如何在调用 AlamoFire 的 POST 函数时使用完成处理程序?

我熟悉通常在.response或.response之后使用alamofire函数。像thispost中的responseJSON或者像这样:funccheckInLocation(accessToken:String,id:Int,latitude:Double,radius:Double,longitude:Double,completionHandler:String){letheaders=["Authorization":"bearer\(accessToken)","Cache-Control":"no-cache","Content-Type":"application/j