nolanlawson/blob-util

Not working with cordova IOS app

saurabhudaniya200 opened this issue · 4 comments

I just tested the library with the cordova based IOS app and it is not working for me, it is going to the error section and when I am trying to check the error by running alert(JSON.stringify(err)) then I am getting blank object like this {}

my code is as follow

 blobUtil.imgSrcToBlob(imageUrl, "image/jpg" ,  'Anonymous').then(function (image) {
                                        alert("success")
                                    }).catch(function (err) {
                                    alert(JSON.stringify(err))
                                    });

Hi, you actually can’t stringify an error object; you need to just console.log(err) and that’s the easiest way to see what the error is. Then you can connect to it using Safari Dev Tools and see what exactly the error is.
Based on your code, it’s hard to say what’s wrong; it could be literally anything, but most likely its that the image doesn’t exist or the server doesn’t support CORS.

luco commented

+1

Trying with file:///

its an FB profile image where "https://static.xx.fbcdn.net/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif" where the response headers already obey the CORS, it was working in android app and normal web but not in IOS hybrid app

Can you provide a test case to reproduce? I think the issue may be that the URL is file:// and Safari UIWebView has some strange bugs when you serve things over file:// but it's hard to tell from the code and description provided.