ios - Swift and SecTrust -
i'm having troubles trying convert code i've found in apple documentation swift code. precise stuff tsl , certificates...
this original code in objective-c
sectrustresulttype secresult = ksectrustresultinvalid; if (sectrustevaluate(trust, &secresult) != errsecsuccess) return; }
and attempt...
var secresult:sectrustresulttype = ksectrustresultinvalid // error 1 if (sectrustevaluate(trust, &secresult) != errsecsuccess) { // error 2 return; }
error 1 is:
'int' not convertible 'sectrustresulttype'
error 2 is:
not find overload '!=' accepts supplied arguments
now, see sectrustresulttype
uint32
, ksectrustresultinvalid
int
... header defined apple suppose should correct :p
typealias sectrustresulttype = uint32 var ksectrustresultinvalid: int { }
about second error don't know how manage since function sectrustevaluate
returns osstatus
(that alias uint32
) , errsecsuccess
osstatus
too.
i'm confused. have suggestion make stuff work!?
i ran issue myself , header docs little bit confusing since constants defined int
s , sectrustresulttype defined uint32
.
but news, solution rather simple init sectrustresulttype
ksectrustresultinvalid
:
var secresult = sectrustresulttype(ksectrustresultinvalid) if (sectrustevaluate(servertrust, &secresult) != errsecsuccess){ return; }
Comments
Post a Comment