Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Can't play videos in Vimeo for iOS

I'm unable to play videos in the app. I believe this is due to a known issue with NSDateFormatter when used to parse/format dates for machine-to-machine communication without setting a locale on the date formatter instance. This affects a number of locales, including the UK (but only when the phone is set to use the 12-hour clock); we see these kind of issues a lot!

Steps to reproduce

Note: you must use a physical iPhone – you can't repro this in the simulator.

  1. Set your phone's locale to UK: Settings > General > Language and Region, set Region to United Kingdom
  2. Set your phone to use the 12-hour clock: Settings > General > Date & Time, set 24-Hour Time to OFF
  3. Open the Vimeo app and attempt to play a video. At this point you'll see an alert saying "Unable to play video. It seems you've set your clock for the future. Fun! Unfortunately, videos won't play normally unless it's reset to your current date and time zone."
  4. Go to Settings > General > Date & Time, set 24-hour clock to ON
  5. Kill the Vimeo app then restart it.
  6. Try to play a video. Note that videos now play correctly.

The problem is that you're using an NSDateFormatter to parse/format dates without specifying the locale to which you expect the serialised dates to adhere. You need to do this:

NSDateFormatter *df = [NSDateFormatter new];
// This is what you're missing:
df.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
// Now do stuff with df.

See https://developer.apple.com/library/ios/qa/qa1480/_index.html for more on this one.

As an aside: I tried to report this in the Vimeo app via "Settings > Support > I think I found a bug in the iOS app", but the "contact us" link leads to a webview where I'm not logged into Vimeo, so I gave up. It would be good to automagically log the user in at that point, as long as they're already logged in in the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment