0
操作我在斯威夫特項目斯威夫特錯誤,而與NSNumbers
var coreDataArray:NSArray = fetchFromCoreData() // Return an array of record
var mediumValue:NSNumber
var tmp:NSNumber
for(var i = 0; i < coreDataArray.count; ++i)
{
tmp = coreDataArray[i].score // The .score value is set as Float in .xcdatamodel
mediumValue = mediumValue + tmp
}
使用此代碼我得到這個錯誤就行了mediumValue = mediumValue + tmp
Could not find an overload for '+' that accepts the supplied arguments
任何意見?
是的,我設法解決迫使他們現在都是'Floats'right! – r4id4
@ObiWanKeNerd在我將它編輯爲文章之前,你已經明白了:) –