Code cracker
Code cracker

Reputation: 3166

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.

Upvotes: 6

Views: 6807

Answers (1)

Shams Ahmed
Shams Ahmed

Reputation: 4513

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

Upvotes: 5

Related Questions