我在Swift应用程序中安装了RestKit。我找不到好的文档来让它在swift中工作。这就是我所拥有的。我也从未使用过rest API。我正在连接到MongoLab。
class Users: NSObject {
var users: String = ""
var url : String = ""
}
let mapDict = ["users":"users","url":"url"]
class ViewController: UIViewController {
override func viewDidLoad() {
let objectManager = RKObjectManager(HTTPClient: client)
let mapDict = ["news":"news","url":"url"]
let usersMapping = RKObjectMapping(forClass: Users.self)
usersMapping.addAttributeMappingsFromDictionary(mapDict)
let responseDescriptor:RKResponseDescriptor = RKResponseDescriptor(mapping: usersMapping,
method: RKRequestMethod.GET,
pathPattern: dburl,
keyPath: nil,
statusCodes: NSIndexSet(index: 200))
let response = RKResponseDescriptor(mapping: usersMapping, method: RKRequestMethod.GET, pathPattern: dburl, keyPath: nil, statusCodes: NSIndexSet(index: 200))
RKObjectManager.addResponseDescriptor(response)
有人能引导我朝正确的方向前进吗?