-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
  • 28,703
  • 48
  • 145
  • 221
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,525
  • 15
  • 38
wattson12
  • 11,136
  • 2
  • 30
  • 34