Post image base64 from iOS to twitter using request.js

326 views Asked by At

I am working on iOS. In my app user can take photo and upload from Library then it will store as image base64 in database. I want to post this image into Twitter when I select from database. But I always get error message below {"errors":[{"code":189,"message":"Error creating status."}]}'

I have found a post below really familiar my problem but I still could not make it works.

Twitter update with media with request.js

Much appreciate for your help!

1

There are 1 answers

0
Dimanche Eat On BEST ANSWER

Finally, I found this solution under this post: Twitter image upload error : media parameter is missing

But one thing to note: make sure your image base64 is not contained full path. This driven me very crazy until I found it. Real example for me

var imageBase64 = data:image/jpeg;base64,4793748374837493749374937434b3b4398498343749374739479374739473947394347373479374334793748374837493749374937434b3b4398498343749374739479374739473947394347373479374334793748374837493749374937434b3b4398498343749374739479374739473947394347373479374334793748374837493749374937434b3b43984983437493747394793747394739473943473734793743...................................................................7979

It is not working. So I have to split as below:

var splitImageBase64 = imageBase64.split(",")[1];

Then it works.

I hope this may help someone else.