SwiftyJSONが読み込めない
SwiftyJSONを使おうとしています。
githubからzipをダウンロードしました。
- zipを解凍したSwiftyJSON-masterフォルダをプロジェクトフォルダにコピーします。
- SwiftyJSON-masterフォルダのSwiftyJSON.xcodeprojをXCodeのプロジェクトにドラッグ&ドロップします。
- Build Phases → Target Dependenciesの+をクリックして「SwiftyJSON iOS」を選択しAddを押す。
以下にソースファイル(ViewController.swift)を添付しますが、ビルドして実行するとライブラリが読めないというエラーが発生します。
dyld: Library not loaded: @rpath/SwiftyJSON.framework/SwiftyJSON
  Referenced from: /private/var/mobile/Containers/Bundle/Application/68BF78B3-012D-428D-BFCB-77D9201CEA42/tableviewsample002.app/tableviewsample002
  Reason: image not found
http://noumenon-th.net/webstrategy/2015/05/22/swiftyjson/ やGitHubのREADME.mdは読んでいます。
XCode 6.4で、iPhone 6で試しています。
import UIKit
import SwiftyJSON
class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        let url = NSURL(string: "http://www.ubuntu.jp/json.php")
        var request = NSURLRequest(URL: url!)
        var data = NSURLConnection.sendSynchronousRequest(request, returningResponse: nil, error: nil)
        if data != nil {
            var json = JSON(data: data!)
            println(json)
        }
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}