Converting between NSData and base64 strings

后端 未结 6 995
野的像风
野的像风 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:10

    As of iOS 7, NSData now directly provides this functionality with the new methods -base64EncodedDataWithOptions: and -base64EncodedStringWithOptions:. (The options let you specify that the string is/should be line-wrapped, the better to deal with email, and user-facing displays.)

提交回复
热议问题