Search code examples
iosobjective-cnsdata

'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?


Solution

  • use this

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

    instand of

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