itdeeps
itdeeps

Reputation: 277

How to decode a data using base64 and save as file object in objective c?

I am new to iphone development.. I am developing an iphone application in which i am getting file in form binary data encoded using base 64.. I m getting the data from web service.. Now i need to convert the binary data to file object and save it to my iphone simulator and need to open it... I ve searched and found the useful following links about base64 decoder:

How do I do base64 encoding on iphone-sdk?

http://www.cocoadev.com/index.pl?BaseSixtyFour

But i dont know how to save decoded data as file??? Can anyone please tell me how to do that???

Thanks in advance..

Upvotes: 1

Views: 3150

Answers (2)

To see your saved files on Files application under your project name folder, enable the below permissions on your Info.plist

enter image description here

Upvotes: 0

Praveen S
Praveen S

Reputation: 10393

[data writeToFile:@"Filename.txt" atomically:YES]; 

This way you can write raw data to a file. You can also check the NSData documentation at apple.

Upvotes: 2

Related Questions