如何连接code的NSData为base64? (iPhone / iPad的) [英] How to encode NSData as base64? (iPhone/iPad)

查看:134
本文介绍了如何连接code的NSData为base64? (iPhone / iPad的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个UIImage添加到 HTML 电子邮件,但我有一个问题。我在很多其他职位环顾四周,他们说我需要我的的NSData 的base64转换,但是所有州他们都建议方法似乎不存在了(除非我失去了一些东西?!)。

I'm trying to add a UIImage to an HTML email, however I'm having an issue. I have looked around at lots of other posts and they all state that I need to convert my NSData to base64, however the method they all suggest doesn't seem to exist anymore (unless I'm missing something?!).

下面是code我到目前为止有:

Here is the code I have so far:

UIImage *mapImage = [mapViewController convertMapToImage];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(mapImage)];
NSString *base64String = // [imageData base64EncodedString];   --- this method isn't recognised

请有人可以帮我吗?

推荐答案

您要使用没有按附带默认框架的方法。您可以在 NSData的类别添加到项目中。

The method you are trying to use doesn come with default framework. You can add the NSData category to your project.

这篇关于如何连接code的NSData为base64? (iPhone / iPad的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆