I received a string from a web service like this:
CAAAAB+LCAAAAAAABADtvQdgHEmWJSYvbcp7f0r1StfgdKEIgGATJNiQQBDswYjN5pLsHWlHIymrKoHKZVZlXWYWQMztnbz33nvvvffee++997o7nU4n99//P1xmZAFs9s5K2smeIYCqyB8/fnwfPyJOp/PqTf6u/X8A1v85+wgAAAA=
The source string was "EchoText" that compressed with Gzip then converted to Base64.
I have to decode Base64 string at first then Unzip that using Gzip.
How can I do in Swift (or Objective-C)?
Edit:
I found a good library for using Gzip: nicklockwood/Gzip
and it's my code:
NSString* base64String = @"CAAAAB+LCAAAAAAABADtvQdgHEmWJSYvbcp7f0r1StfgdKEIgGATJNiQQBDswYjN5pLsHWlHIymrKoHKZVZlXWYWQMztnbz33nvvvffee++997o7nU4n99//P1xmZAFs9s5K2smeIYCqyB8/fnwfPyJOp/PqTf6u/X8A1v85+wgAAAA=";
NSData* compressedData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
NSData* unCompressedData = [compressedData gunzippedData];
NSString *result = [[NSString alloc] initWithData:unCompressedData encoding:NSUTF8StringEncoding];
but the result is nil.