ios - 'init' is unavailable: use 'withMemoryRebound(to:capacity to temporarily view memory as another layout-compatible type -


enter image description here learning , migrating code swift 3 , facing following error in glimpsexml. can please ? in advance.

[![enter image description here][1]][1]     [1]: https://i.stack.imgur.com/vjo2b.png 

sorry posting screenshot only. here actual code. version of xcode 8.3.1. in method stringfromfixedcstring getting error "fromcstringrepairingillformedutf8" unavailable.

private func stringfromfixedcstring(_ cs: unsafebufferpointer<cchar>) -> string? {     let buf = unsafemutablepointer<cchar>.allocate(capacity: cs.count + 1)     buf.initialize(from: cs + [0]) // tack on 0 make valid c string     let (s, _) = string.fromcstringrepairingillformedutf8(buf)     buf.deallocate(capacity: cs.count + 1)     return s  } public func serialize(_ indent: bool = false, encoding: string? = "utf8") -> string {         var buf: unsafemutablepointer<xmlchar>? = nil         var buflen: int32 = 0         let format: int32 = indent ? 1 : 0          if let encoding = encoding {             xmldocdumpformatmemoryenc(castdoc(self.docptr), &buf, &buflen, encoding, format)         } else {             xmldocdumpformatmemory(castdoc(self.docptr), &buf, &buflen, format)         }          var string: string = ""          if buflen >= 0 {             if let str = stringfromfixedcstring(unsafebufferpointer(start: unsafepointer(buf), count: int(buflen))) {                 string = str             }             buf?.deallocate(capacity: int(buflen))         }         return string     } 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -