Saturday, November 7, 2026
HomeiOS Developmentios - Swift: NSArray aspect did not match the Swift Array Aspect...

ios – Swift: NSArray aspect did not match the Swift Array Aspect sort Anticipated HTMLElement however discovered HTMLElement

[ad_1]

I’ve searched the web concerning this drawback, however mine appears to be a lot particular. I am attempting to parse a HTML doc utilizing queryselector as comply with:

let doc = HTMLDocument(string: str)
      let components = doc.querySelectorAll("script")
      components.forEach { ddElement in
        if(ddElement.elementId == "js-competition"){
          scr = ddElement.textContent

and on components.forEach line this system crashes with the next error:

Precondition failed: NSArray aspect did not match the Swift Array Aspect sort Anticipated HTMLElement however discovered HTMLElement

The error might be seen right here

The truth that the anticipated sort is similar with the discovered one, it is very bizarre. Every little thing was working high quality, till I renamed the mission and a few updates for conversion to Swift 5 had been triggered. The construct is for iOS 15.2.

Did you face points like this earlier than? As a result of for me it seems like a xCode bug.

Thanks!

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments