2016-03-30 7 views
0

私たちはプレイグラウンドを使用してAlomofire GETリクエストをテストしようとしています。動作していますが、Playgroundで要求によって返されたJSONを見ることはできません。どのようにこれを行うことができますか?スクリーンショットの右矢印をクリックしてもJSONは表示されません。Swift PlaygroundでGETリクエストの結果を表示

遊び場:

enter image description here

request's JSON応答:要求が完了する前に終了し

{ 
    "userId": 1, 
    "id": 2, 
    "title": "qui est esse", 
    "body": "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla" 
} 
+0

こちらをご覧ください:http://stackoverflow.com/a/33536290/4096655 –

+0

あなたは正しいです。ありがとう。私はそれを閉じるために投票した。ありがとう。 –

答えて

1

あなたの遊び場。 needsIndefiniteExecution = trueを設定することにより、無期限にそれを一時停止:

import UIKit 
import SwiftyJSON 
import Alamofire 
import XCPlayground 

Alamofire.request(.GET, "http://jsonplaceholder.typicode.com/posts/2") 
    .responseJSON { response in 
     let json = JSON(data: response.data!) 
     print(json) 
    } 

XCPlaygroundPage.currentPage.needsIndefiniteExecution = true 
+0

ありがとうございます。私はこのAPIがstackoverflow.com/a/33536290/4096655ごとに変更されたと考えています。助けてくれてありがとう。 –