How is it possible to get a base64 string from an NSData
instance?
Asked
Active
Viewed 2.8k times
8

jscs
- 63,694
- 13
- 151
- 195

user754229
- 317
- 1
- 3
- 8
-
3There are at least two existing SO questions that answer this: http://stackoverflow.com/questions/2197362/converting-nsdata-to-base64 and http://stackoverflow.com/questions/5999370/nsdata-to-base64 Please search before posting. These would've shown up when you typed in your question title, as well. – jscs May 15 '11 at 06:29
-
@Josh Caswell - sorry I am a newbie on SO. I'll make sure this next time! – user754229 May 15 '11 at 06:31
-
2I understand. Please be aware that the list that pops down after you type the title of your question is supposed to help you, though. Look it over before you post. Welcome to SO! – jscs May 15 '11 at 06:46
3 Answers
22
please try to search before posting questions I already post a answer for this here - Verifying a Receipt with the App Store - try this function there.
-
-
@Saurabh I used this method to convert image data to NSString to send image in mail with HTML code. I can see image in iPhone's mail application but its not working with Gmail only. it's also working with yahoo mail. Can you help me on this? – Chirag Patel Sep 12 '13 at 13:33
-
1
(if you targeting on IOS 7 ...) There is an easy way using provided API: https://stackoverflow.com/a/19088341/2481444
I also tested the accepted code. They both generate the same result.
It also has decoding function. @S.J
1
NSString* base64String = [nsdata base64Encoding];

user2992030
- 45
- 8
-
2Please add an explaination why you think that this solves the problem. Otherwise, it lacks context and is likely to be removed due to “low quality”. – lxg Sep 19 '14 at 08:54