Reputation: 7318
Since upgrading to swift 1.2 I can't compile my code because if this error message:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
There is absolutely no more specific error messages in my files so it's almost impossible to find the problem.
I ran this to try to find the culprit file:
xcodebuild -project myApp -scheme myApp;
and it pointed to 4 files that may cause issue but without specifying why. Here is the content of on of these file, do you see a single reason why swift 1.2 can't compile this ?
import Foundation
struct UserScore {
static var scoreValue: Int = 0
var myLabel: UILabel
}
//Called in HandleVote
class CalculateScore {
func updateScore(scoreLabel: UILabel) {
UserScore.scoreValue += 1
scoreLabel.text = String(UserScore.scoreValue)
}
}
class UpdateScoreInParse {
func updateScore () {
let user = PFUser.currentUser()
var query = PFUser.query()
query.getObjectInBackgroundWithId(user.objectId) {
(score: PFObject!, error: NSError!) -> Void in
if error != nil {
println(error)
} else {
score.incrementKey("score")
score.saveInBackground()
}
}
}
}
class UpdateScoreLocally {
func updateScore(label: UILabel) {
let user = PFUser.currentUser()
user.fetchInBackgroundWithBlock({ (user: PFObject!, error: NSError!) -> Void in
if error == nil {
let parseScore = Int(user["score"] as! NSNumber)
UserScore.scoreValue = parseScore
label.text = String(parseScore)
} else {
NSLog("Error: ", error)
}
})
}
}
Upvotes: 0
Views: 187
Reputation: 7318
I found the problem, which seems unrelated to these files. The problem turned to be the import of a third party library, that would cause this error if it resided outside the project directory. It never caused problem with swift < 1.2.
When I moved the library IN the project folder, these files stopped triggering error. I really don't know why since those files didn't import and didn't used that library. Anyway, I was able to clear those errors, but I have a new one, which fortunately, I have more explicit error for.
So it seems the above code doesn't have any specific problem.
Upvotes: 1