swift / jsonをhttp経由で取得
Download
- https://github.com/Alamofire/Alamofire
- Download後、[Alamofire.xcodeproj]をライブラリメニューにペースト
setting
- general > embed Binary で[+]で追加。
- [Alamofile iOS]を選択して追加
code
let requestUrl = "https://ajax.googleapis.com/ajax/services/search/news?v=1.0&topic=p&hl=ja&rsz=8"; Alamofire.request(.GET, requestUrl, parameters: nil).responseJSON { response in if let json = response.result.value { print(json) } }