先安装ALAMOFIRE,我选择的是 ~>3.0
CocoaPods 1.0.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Installing Alamofire (3.1.5)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `AlamofirePro.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
ymdeMacBook-Pro:AlamofirePro ym$
Xcode下语法:
Alamofire.request(.GET,"http://www.ietaiji.com/ttttt.php", parameters: ["id":"13"])
.responseJSON { responsein
/*
print(response.request) // original URL request
print(response.response) // URL response
print(response.data) // server data
print(response.result) // result of response serialization
*/
iflet JSON = response.result.value {
print("JSON is :\(JSON)")
}
}
或者:
//可以请求数据
Alamofire.request(.GET,"http://www.ietaiji.com/ttttt.php", parameters: ["id":"13"])
.responseData { responsein
print(response.request)
print(response.response)
print(response.result)
let v = response.result.value
print(v!)
}