[Test case failing v3.9] cc.loader.loadImg not working on iOS 8.1

Hi,

I’m using Cocos2D-JS v3.9 and I’m trying to load remote images in my game. So I’m doing the following:

cc.loader.loadImg(url, function(err, texture) {
  // Do something with the texture if there is one
});

This works on Web and Android, but not on iOS 8.1 (also tried on iOS 9.0, not working).
Actually, the callback is not even called!

I tried

cc.loader.loadImg(url, {isCrossOrigin: true}, function(err, texture) {});
cc.loader.textureCache.addImageAsync(url, function(err, texture) {});
cc.loader.textureCache.addImage(url, function(err, texture) {});

Again, the callback is not called.

  • I know about the App Transport Security exceptions
  • I tried to get an image from different servers in HTTPS
  • I do have network access since I’m calling web APIs through cc.loader.getXMLHttpRequest()

I then tried to ping the image directly using the cc.loader.getXMLHttpRequest(), the request has a status 200 but the responseText is empty!

Does anyone have a guess about what’s happening?

Thanks!

Update on my progress:

  • The “TextureCache” JS test case is failing to load a remote image in Cocos2D-v3.9
  • The “TextureCache” JS test case is successfully loading a remote image in Cocos2D-v3.7

I have met the same problem, have you solved it?

Nope. There’s probably something to be modified in the Downloader.cpp file.

I’m actually waiting for Cocos2D-v3.10 (which should come out this week I guess), hoping they’ll have fixed the issue. Otherwise I’ll probably take time to dig into this (or just switch back to v3.7).