I wrote some code in a command-line-tool application, and it run correctly. But when I brought it to my iOS application, it went wrong.
The essentil code is:
let foo = CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.GBK_95.rawValue))
let bar = String.Encoding(rawValue: foo)
print("foo=\(foo)")
print("bar=\(bar)")
When I run these code in a command-line-tool application, I got:
foo=2147485233
bar=Chinese (GBK)
When I run these code in a iOS application, I got:
foo=2147485233
bar=
It seems amazing that the code got different result in two environment. Does bar get an empty Enumeration value?How can I resolve it?