2017-08-07 2 views
0

Iは以下のコードをコンパイルしようとすると、私はエラーを取得:RxAlamofire:メンバーにあいまい参照 'JSON(_:_:パラメータ:符号:ヘッダー:)'

Ambiguous reference to member 'json(::parameters:encoding:headers:)'

コードがコピーされたとRxAlamofireのために、あなたはjson(::parameters:encoding:headers:)を使用し、代わりに、URLSession RX拡張子を使用する必要はありませんが、エラーを修正するにはRxAlamofireのGithubリポジトリのページ

import RxSwift 
import RxAlamofire 

class CurrencyRest { 

     static func getJson() { 

      let stringURL = "https://api.fixer.io/latest" 

      // MARK: NSURLSession simple and fast 
      let session = URLSession.init() 

      _ = session.rx.json(.get, stringURL) 
       .observeOn(MainScheduler.instance) 
       .subscribe { print($0) } 
     } 

} 

答えて

0

から貼り付け、session.rx.json(url:)が移動するための方法である、それは、RxCocoaからです、例えばjson(.get, stringURL)は、JSONとして使用できるObservable<Any>を返します。

関連する問題