您好,我已从 AlchemyAPI 移至 DiscoveryV1,但我的 swift 程序出现 401 错误,错误 Domain=com.ibm.watson.developer-cloud.DiscoveryV1 Code=401 "Not Authorized" UserInfo={NSLocalizedFailureReason=Not Authorized}
该应用程序在迁移到 Discovery 之前运行良好,Bluemix 支持团队已经验证了凭证并且在 BLuemix 中运行查询时没有出现错误
为此,我还将 url 添加到应用程序传输安全设置中,这是一个猜测,但它没有改变错误我添加了应用程序传输设置的屏幕截图
这是我使用的凭据 let wdn = Discovery(username: "my-user-name", password: "my-password", version: "2017-03-08")
let environmentID = "envID generated under my account on bluemix"
let collectionID = "collectionID generated under my account on bluemix"
let filter = ""
let query = newsSearchString < variable set later
let aggregation = "term(enriched_text.concepts.text).top_hits(10)"
let numberOfItemsToReturn = 30
let failure = { (error: Error) in print(error) }
let returnEntities = "enriched.url.url,enriched.url.title,enriched.url.author"
[enter image description here][1]
[1]: https://i.stack.imgur.com/5UvJO.png