Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iOS simulator fallback for UTType #19669

Merged

Conversation

aleqsio
Copy link
Contributor

@aleqsio aleqsio commented Oct 24, 2022

Why

Closes #16383

It seems this line doesn't work on iOS simulator on M1 macs when the app is run through Rosetta (as Expo GO is):

expo/packages/expo-media-library/ios/EXMediaLibrary/EXMediaLibrary.m:927

CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);**

It seems that this is a common issue:

ionic-team/capacitor#4903

https://developer.apple.com/forums/thread/685968

https://developer.apple.com/forums/thread/702933

The UTTypeCreatePreferredIdentifierForTag method is also deprecated.

Unfortunately, changing to the non-deprecated [UTType typeWithFilenameExtension] also returns nil on M1 simulator.

How

We can do a lookup table for mapping extensions to media types if iOS functions return nil.

Test Plan

I've tested the fallback code on iOS simulator.

Checklist

@linear
Copy link

linear bot commented Oct 24, 2022

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Oct 24, 2022
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Oct 24, 2022
Copy link
Contributor

@lukmccall lukmccall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 🔥

Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@swmansion.com>
@brentvatne
Copy link
Member

@tsapeta - can ensure that this lands before ios versioning?

@aleqsio
Copy link
Contributor Author

aleqsio commented Oct 25, 2022

Ci for check packages fails due to #19621 on main, so unrelated issue. Tested the new non-deprecated method on device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[expo-media-library] createAssetAsync() on iOS throws: This file type is not supported yet
5 participants