let url = URL(string:“https://dapi.kakao.com/v3/search/book?target=title&query=java”)
//print(url!)
let request = Alamofire.request(url!, method: .get, encoding: JSONEncoding.prettyPrinted, headers: ["Authorization": "KakaoAK RestAPI앱키"])
request.responseJSON{response in
print(response.result.value!)
let data = try! Data(contentsOf: url!)
print(data)
let result = try! JSONSerialization.jsonObject(with: data, options: []) as! [String:Any]
print(result)
let document = result["documents"] as! NSArray
for index in 0...(document.count - 1){
let documents = document[index] as! NSDictionary
self.titles.append(documents["title"] as! String)
self.authors.append(documents["authors"] as! String)
}
print(self.titles)
print(self.authors)
}
tableView.dataSource = self
}
result에서 [“message”: cannot find appkey, “errorType”: AccessDeniedError]가 출력이 되는데 헤더를 잘못작성한건가요?