Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'initWithBase64Encoding' is deprecated?

I want to get the data from the string. i am using the following code but it seems to be deprecated.

 NSData *data=[[NSData alloc]initWithBase64Encoding:(NSString *)dict];

I got the data. But its give me the warning that 'initWithBase64Encoding' is deprecated. So is there any other method that will return data?

like image 338
Sunny Shah Avatar asked Feb 01 '14 06:02

Sunny Shah


2 Answers

use this

NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];

instand of

NSData *data=[[NSData alloc]initWithBase64Encoding:(NSString *)dict];
like image 69
Bug Avatar answered Sep 23 '22 03:09

Bug


Returns a data object initialized with the given Base-64 encoded string. (Deprecated in iOS 7.0. You should transition to either initWithBase64EncodedString:options: or initWithBase64EncodedData:options:.)

like image 40
Retro Avatar answered Sep 26 '22 03:09

Retro