Converting between NSData and base64 strings

后端 未结 6 999
野的像风
野的像风 2020-11-29 01:38

What is the easiest and fastest code to do a conversion between NSData and a base64 string? I\'ve read a bunch of solutions at SO and mostly they involve in add

6条回答
  •  长情又很酷
    2020-11-29 02:04

    I ended up using this same class as provided by SUDZC

    implementation was easy first I did an import

     #import "NSData+Base64.h"
    

    then I was able to call my data.

     NSData *data = [[NSData alloc] initWithData:[NSData dataWithBase64EncodedString:strData]];
    

提交回复
热议问题