ios - Cannot invoke 'CCHmac' with an argument list of type '(UInt32, UnsafePointer<Int8>, UInt, [CChar], Int, UnsafeMutablePointer<CUnsignedChar>) -


i updated xcode and/or swift 1.0 1.2 , got lots of errors,

i knew of methods updated/changed in swift 1.2 hence started updating whole project swift 1.2. stuck on line:

cchmac(cchmacalgorithm(kcchmacalgsha1), ckey, strlen(ckey), str!, strlen, result) 

it's throwing error cannot invoke 'cchmac' argument list of type '(uint32, unsafepointer<int8>, uint, [cchar], int, unsafemutablepointer<cunsignedchar>)'

here code

. . .  let str = cred.cstringusingencoding(nsutf8stringencoding)         let strlen:int = int(cred.lengthofbytesusingencoding(nsutf8stringencoding))         let digestlen = int(cc_sha1_digest_length)         let result = unsafemutablepointer<cunsignedchar>.alloc(digestlen)         let objckey = key nsstring         let keystr = key.cstringusingencoding(nsutf8stringencoding)         let keylen:int = int(key.lengthofbytesusingencoding(nsutf8stringencoding))          var st:nsstring = datafromhexadecimalstring(key)!         let ckey = st.cstringusingencoding(nsutf8stringencoding)           cchmac(cchmacalgorithm(kcchmacalgsha1), ckey, strlen(ckey), str!, strlen, result) . . . 

note: changed keylen , strlen uint int still throwing same error.

i solved cast strlen(ckey) int int(strlen(ckey))

whole line is

cchmac(cchmacalgorithm(kcchmacalgsha1), ckey, int(strlen(ckey)), str!, strlen, result) 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -