Consistent "Image isn't readable" error on iOS

#1

Greets,

I’m building an extremely simple app that takes the URL to a podcast feed, goes out, snags all of the information, and allows you to play each podcast in the series. Everything’s working, including snagging the audio from a URL and caching it when a user first plays a given podcast, but on Apple devices specifically I’m running into a problem when trying to display the image associated with the podcast. Essentially every podcast feed I try gives me the following error:

File 'http://i1.sndcdn.com/avatars-000423015784-7lpcpu-original.jpg' isn't readable

The URL changes, but the error message remains the same. I’ve tested with multiple podcast RSS feeds from completely different servers, and the error’s consistent. The exact same URL runs fine on my Nexus 5X, but generates the error on my iPhone 5S, and on my iPhone X Simulator running on OSX.

Here’s the code I’m using to work with the image:

import { ImageManipulator } from 'expo';

...

    // Make sure the image isn't gigantic!
    const initialImage: string = feedParsed.rss.image.url;
    let formattedImage: Object = {};
    try {
      formattedImage = await ImageManipulator.manipulate(
        initialImage,
        [{ resize: { width: 400, height: 400 } }],
        { base64: false },
      );
    }
    catch (error) {
      this.showError(new Error(error));
      formattedImage = { uri: '' };
    }

I’ve tested the URLs manually and they work just fine. You can plug the one above into a browser and see the image.

I’m on Expo SDK 25 and haven’t upgraded because that’s what’s tied to the version of Create React Native App I initially started with. If this is a known bug that’s fixed in a later version, please let me know. Otherwise, I’d love to hear any thoughts as to what might be the problem.

Thanks!

-Chris

#2

No responses, but in case anyone else is looking … my current workaround for this is to just use the unformatted image on iOS, since unlike Android, iOS doesn’t slow to a crawl when the images are really big. This is not my preferred approach, but the imageManipulator API is insisting the image isn’t readable on iOS, even though it works fine on Android (and the original image displays fine on both platforms). Here’s the code:

    if (Platform.OS !== 'ios') {
      try {
        formattedImage = await ImageManipulator.manipulate(
          initialImage,
          { resize: { width: 400, height: 400 } },
          { base64: false },
        );
      }
      catch (error) {
        this.showError(new Error(error));
        formattedImage = { uri: '' };
      }
    }
    else {
      formattedImage = { uri: initialImage };
    }
closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.