I need to convert image to base 64 string from image's uri(avatar uri) in objective c. This is my input uri
file:///Users/My/Library/Developer/CoreSimulator/Devices/81D640F9-A776-5B3D/data/Containers/Data/Application/4094435F-04-5A8A75/Documents/F67871-6762-47A5-C8CDC.jpg
This is my code,
RCT_EXPORT_METHOD(baseConvert:(NSURL *)url1)
{
NSLog(@"My Input Uri:%@",url1);
NSData* data = [NSData dataWithContentsOfURL:url1];
//NSString *base64Encoded = [data base64EncodedStringWithOptions:0];
// NSString *base64Img = [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
NSString *base64Img = [data base64EncodedStringWithOptions:0];
NSLog(@"My output String:%@",base64Img);
}
The above code creates a string. But it only gives upper part of image, when I check the Output String on online image decoders.Please help me ....