-5

I'm new in objecive-C and i would like to decode a NSString encoded in Base64.

Have you any idea to help me?

NSString encoded:

eyJjbGUiOiJwOW5oOTk3eDRxdhpnZzciLCJ1cmwiOiJtbGtqcW1sa3FzbWxmbXFsanFkln0

NSString i try to find:

{"cle":"p9nh997x4qvgg7","url":"mlkjqmlkqsmlfmqljqd}

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
user2032850
  • 9
  • 1
  • 1
  • 3

1 Answers1

5

get a base64 library: https://github.com/l4u/NSData-Base64

Create NSData from the string:

NSData *data = [NSData dataFromBase64String:string];

convert that data to a string

NSString *convertedString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
JustAnotherCoder
  • 2,565
  • 17
  • 38
wattson12
  • 11,176
  • 2
  • 32
  • 34