6

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.

1 Answer 1

5

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
2
  • Whats the difference between NSDataBase64Encoding64CharacterLineLength and NSDataBase64Encoding76CharacterLineLength Commented Jan 17, 2015 at 20:41
  • 1
    there varies RFC specs out there see wiki link. NSData has to support all length, there not much difference apart from maximum length and when to insert the line break Commented Jan 17, 2015 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.