Here is my code.
UIImage *img = [UIImage imageNamed:@\"white.jpeg\"]; NSData *imageData = UIImagePNGRepresentation(img); NSString *imageString = [imageData
inspired from Fadi Abuzant answer here is the Swift 3 version
stringBase64 = stringBase64.replacingOccurrences(of: "+", with: "%2B")