Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'count' is unavailable: there is no universally good answer #442

Closed
BlakeBarrett opened this issue Dec 14, 2017 · 7 comments
Closed

'count' is unavailable: there is no universally good answer #442

BlakeBarrett opened this issue Dec 14, 2017 · 7 comments

Comments

@BlakeBarrett
Copy link
Contributor

BlakeBarrett commented Dec 14, 2017

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
   }
}
@BlakeBarrett
Copy link
Contributor Author

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.

@BlakeBarrett
Copy link
Contributor Author

This Pull Request fixes this issue (for me).

@introrse
Copy link

introrse commented Jan 8, 2018

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.

@introrse
Copy link

introrse commented Jan 9, 2018

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.

@daltoniam
Copy link
Owner

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.

@Saifalip
Copy link

Saifalip commented Feb 28, 2018

@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

@BlakeBarrett
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants