Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Error says value of type 'GKRandomSource' has no member with 'nextIntWithUpperBound'. Xcode ver. is 8.0

I looked up in documentation and couldnt figure it out. Kindly help me understand whats going on. Thanks.

Screen Shot 2016-09-28 at 1.49.10 PM.png

1 Answer

The syntax for this method is slightly different with the latest version of iOS.

Try this instead:

let randomNumber = GKRandomSource.sharedRandom().nextInt(upperBound: colors.count)

Thanks David, appreciate the reply. I did realize that declaration has changed with the new version of swift. It fixed the issue.