Sto cercando di recuperare i valori dall'array JSON e ricevo un messaggio di errore "Trasmetti da 'XCUIElement!' a String non correlato fallisce sempre. "Xcode 7 Trasmissione da XCUIElement a tipo non correlato 'String' non riesce sempre durante il recupero di JSON
Sto utilizzando Xcode 7 con iOS 9.1.
Il mio codice è il seguente:
let url = NSURL(string: urlAsString)!
let urlSession = NSURLSession.sharedSession()
let jsonQuery = urlSession.dataTaskWithURL(url, completionHandler: { data, response, error -> Void in
if (error != nil) {
print(error!.localizedDescription)
}
do {
let jsonResult = (try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers)) as! NSMutableArray
// print (jsonResult)
for usernames in jsonResult {
let influencer_username = usernames["influencer_username"] as! String
print("influencer_username: \(influencer_username)")
}
XCUIElement viene utilizzato per target di test. Come viene risolto questo errore, senza rimuovere il target di test? – Sravan
sì, ho fatto la stessa cosa. L'ho rimosso dal target di test e il problema è stato risolto. Comunque non stavo facendo test unitari. –
Se si rimuove la classe dalla destinazione, non è possibile eseguire test. Quindi questa non è una soluzione, questa è solo una soluzione per evitare gli avvertimenti. – MatterGoal