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 trialScott Baumbich
Courses Plus Student 22,129 PointsrandomTemperature variable error in x Code
Currently I am running xCode version 7.0.1 If anyone has encountered the error: "Cannot call value of non-function type 'UInt32' " while copying Pasan's randomTemperature variable as seen below:
import Foundation
var randomTemperature = Int(arc4random_uniform(UInt32(150)))
The following code will eliminate the error:
import Foundation
var randomTemperature = Int(arc4random_uniform(150))
Like Pasan said, don't worry to much about the specifics of this code. Just know he will explain it in greater detail at a later time and you can continue your playground error free.
This problem might be caused by some mistake I made earlier in my code, however I figured I would post the solution in case anyone else runs into the same error.
3 Answers
Raphael Reiter
6,820 PointsI get the same error as you. it disapears when i un indent the "case"...
Alex Hernandez
Courses Plus Student 1,936 PointsI have used the syntax that Pasan used and no error occurred. Im using Xcode Version 7.1 (7B91b).
Scott Baumbich
Courses Plus Student 22,129 PointsIt may have just been a minor mistake on my end somewhere in the code. I know 7.1 had a few bug fixes, maybe that was one of them?
Alex Hernandez
Courses Plus Student 1,936 PointsMaybe you have an error in your code, you have to be careful because XCode doesn't have a good explanation and identification of errors, most cases XCode says incorrect things. PD: Here i have to say that C#(Visual Studio) is pretty good on Error identification.
Jason Ernsdorff
3,112 PointsI found if I manually type the whole line exactly as it is supposed to be that it works but if I use the autocompletion to fill in the line in XCode that it generates errors and has different formatting. Just type it as Pasan has it manually and it should work.
Idris omar
971 PointsIdris omar
971 Pointsman you saved me a headache i was stuck at this for 3o mins straight . Thank you brother