How do i transform a file(any type of file) in Base64 to send to a web service Objective C
I need to send a files to a XML web service. The web service only accepts the file in a base64 format and rebuilds it in the back end. I need to know how do i开发者_JAVA百科 convert a file to base64 in Objective C.
Check below SO post
How do I do base64 encoding on iphone-sdk?
How can I decode data with Base64 in IPhone
How to Base64 encoding on the iPhone
UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imagedata = UIImagePNGRepresentation(viewimage);
NSString *encodedString = [imageData base64Encoding];
where view is the view where lines are drawn.
精彩评论