ios - Swift: 'Int32' is not convertible to 'Int32' -
i'm in middle of project using swift 1.1 , xcode 6.1.1
i receive following error when trying make seconds out of value , timescale
path/viewcontrollers/camera/capturescreenviewcontroller.swift:41:58: 'int32' not convertible 'int32'
on line following line
var seconds = cmtimemakewithseconds(float64(value),timescale)
at ,timescale)
below few lines reference
var currentcellsegment = segmentforindexpath(indexpath) var value = currentcellsegment.duration.value.value var timescale = currentcellsegment.duration.timescale.value var seconds = cmtimemakewithseconds(float64(value),timescale)
any suggestions on how fix? or answers why happening?
things have tried
i have uninstalled xcode, restarted, , re-installed.
i've tried cast timescale as int32 so
var timescale = currentcellsegment.duration.timescale.value int32
var timescale: int32 = currentcellsegment.duration.timescale.value
var timescale: int32 = currentcellsegment.duration.timescale.value int32
, receive error on line var timescale...
as suggested by @martin-r
new reference code
var currentcellsegment = segmentforindexpath(indexpath) var value = currentcellsegment.duration.value var timescale = currentcellsegment.duration.timescale var seconds = cmtimemakewithseconds(float64(value),timescale)
solved
the error message indeed bit strange, solution remove unnecessary .value calls:
var value = currentcellsegment.duration.value var timescale = currentcellsegment.duration.timescale if currentcellsegment.duration struct cmtime timescale property cmtimescale aka int32, , cmtimemakewithseconds() expects.
the value property of int32 returns builtin.int32, , causes strange error message. example:
func abc(x : int32) { println(x) } let x = int32(1) abc(x) // ok abc(x.value) // error: 'int32' not convertible 'int32'
Comments
Post a Comment