【发布时间】:2017-01-25 05:01:18
【问题描述】:
我正在尝试在真实设备(iPhone 7 plus)上构建我的应用程序。我的应用程序在模拟器上运行得很好,但是当我尝试在真实设备上构建它时,它给了我 2“Ambiguous use of subscript errors”。
let url = URL(string: "https://api.cognitive.microsoft.com/bing/v5.0/news/search?q=\(feedsArray[i])&count=3&mkt=en-in")
var request = URLRequest(url: url!)
request.setValue("MY SUBSCRIPTION KEY", forHTTPHeaderField: "Ocp-Apim-Subscription-Key")
Alamofire.request(request as URLRequest).responseJSON {response in
if let json = response.result.value as? [String:AnyObject]{
if let value = json["value"]{
//
print("json \(json)")
for j in 0..<value.count{
let items = value[j] as! [String: AnyObject]
let name = items["name"] as! String
let url = items["url"] as! String
let description = items["description"] as! String
let datePublished = items["datePublished"] as! String
let dateAndTime = datePublished.replacingOccurrences(of: "T", with: " ")
我在行中有错误
let items = value[j] as! [String: AnyObject]
【问题讨论】:
标签: ios arrays json swift string