Starscream: 'count' is unavailable: there is no universally good answer

Created on 14 Dec 2017  Â·  7Comments  Â·  Source: daltoniam/Starscream

I updated to the latest version (3.0.3) and am now getting a strange error in four places.

My environment is:
• Xcode 8.3.3
• Swift 3.2
• Starscream 3.0.3

The errors I'm seeing are:

  • /…/WebSocket.swift:270:86: 'count' is unavailable: there is no universally good answer, see the documentation comment for discussion

    • /…/WebSocket.swift:593:35: 'count' is unavailable: there is no universally good answer, see the documentation comment for discussion

    • /…/WebSocket.swift:877:26: 'count' is unavailable: there is no universally good answer, see the documentation comment for discussion

    • /…/WebSocket.swift:878:33: 'count' is unavailable: there is no universally good answer, see the documentation comment for discussion

I imagine this would be simple enough to fix with:

fileprivate extension String {
   var count: Int {
      return self.characters.count
   }
}

All 7 comments

I am running Xcode 8.3.3 in Swift 3.2 language mode.
I assume this came about because the rest of the civilized world has upgraded to Xcode 9/Swift 4 by now.

This Pull Request fixes this issue (for me).

I had the same problem using Xcode 8.3.3, also in Swift 3.2 mode, and a brand-new Carthage-based install. I manually applied Blake's patch and it resolved the issue.

Also, for anyone else wondering, Xcode 9.2 seems to work out of the box, without the patch mentioned above. Which makes sense since Swift 4 made Strings collections again.

ha, yeah I didn't do anything with Swift 3.2 😄. I pulled in your PR though (#443) into the latest 3.0.4 release. Thanks again.

@daltoniam could help me i am also facing the same error 'count' is unavailable: there is no universally good answer.
i am using xcode 8.1 to run

Which version of Starscream are you using in your project @Saifalip?
Updating to version 3.0.4 (which includes the fix I linked to) solved all my problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blajivskiy picture blajivskiy  Â·  6Comments

LondonAtlas picture LondonAtlas  Â·  3Comments

lveselovsky picture lveselovsky  Â·  3Comments

milanstevanovic picture milanstevanovic  Â·  5Comments

NickNeedsAName picture NickNeedsAName  Â·  5Comments