How I decode encoded string in iOS?

1.3k Views Asked by At

I am using iMagRead card reader library for iOS. When I swipe the card then I got this type of data enter image description here

How do I convert this data into real data? I have tried this already but fail.

NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:text options:0];
NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
NSLog(@"decoded string %@", decodedString); // NULL
1

There are 1 best solutions below

3
On

You can do something like this,

  NSString *string = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];

//pass data which you got from swipe as parameter

Hope this will help :)