2017-02-08 2 views
0
self.manager!.request(url+"Find/"+(self.userLogged?.teacherId)!, method: .get, encoding: URLEncoding.httpBody,headers: headers 
       ).responseObject(keyPath: "") { (response: DataResponse<[Teacher]>) in 

私は教師のarraylistになる必要があります。教師オブジェクトではありません。どうすればいいの?あなたは、私はそれが役に立てば幸いアラモファイアarraylist

self.manager!.request(url+"Find/"+(self.userLogged?.teacherId)!, method: .get, encoding: URLEncoding.httpBody,headers: headers).responseArray { (response: DataResponse<[Teacher]>) in 
    let teacherArray = response.result.value 
    // You can access your array here. 
} 

を使用してJSONオブジェクトを取得することができます代わりにresponseObjectを得るための迅速な3

答えて

1

を使用していただきありがとうございます。

+0

私はDataResponse lkeを添付できませんか?私は本当にループし、自分でマッピングする必要がありますか? –

+0

[AlamofireObjectMapper](https://github.com/tristanhimmelman/AlamofireObjectMapper)のようなサードパーティライブラリを使用することができます。これはあなた次第です。 – ridvankucuk

+0

私はそれを使用していますが、私はこのDataResponse のように指定していますが、教師が1人返されます。<[teacher]> arraylistが必要です。 –

関連する問題