Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Base64Encoding is deprecated : first deprecated in iOS 7.0

I've downloaded the Base64 library from GitHub.I used it in my project to decode the Images from webserver. I made this project for iOS7.0 The warning am getting with base64 is:

'base64Encoding' is deprecated : first deprecated in iOS7.0.

Thanks in advance.

like image 234
Code cracker Avatar asked Oct 01 '22 10:10

Code cracker


1 Answers

Started from iOS 7 SDK , NSData class now has methods that help encode/decode base 64 data and string objects with the following:

- (instancetype)initWithBase64EncodedData:(NSData *)base64Data
                                  options:(NSDataBase64DecodingOptions)options

- (instancetype)initWithBase64EncodedString:(NSString *)base64String
                                    options:(NSDataBase64DecodingOptions)options

Once you got your NSData instances initialize a UIImage object with: + (UIImage *)imageWithData:(NSData *)data

types of encoding:

 - NSDataBase64Encoding64CharacterLineLength     
   NSDataBase64Encoding76CharacterLineLength     
   NSDataBase64EncodingEndLineWithCarriageReturn     
   NSDataBase64EncodingEndLineWithLineFeed

types of decoding:

- NSDataBase64DecodingIgnoreUnknownCharacters
like image 125
Shams Ahmed Avatar answered Oct 17 '22 00:10

Shams Ahmed