nolanlawson / blob-util

Cross-browser utils for working with binary Blobs
https://nolanlawson.github.io/blob-util
Apache License 2.0
503 stars 45 forks source link

Not working with cordova IOS app #25

Closed saurabhudaniya200 closed 7 years ago

saurabhudaniya200 commented 8 years ago

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))
                                    });
nolanlawson commented 8 years ago

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 8 years ago

+1

Trying with file:///

saurabhudaniya200 commented 8 years ago

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

nolanlawson commented 8 years ago

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.