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

Expo document-picker doesn't work with use_frameworks #19105

Open
AndrewJack opened this issue Sep 14, 2022 · 10 comments
Open

Expo document-picker doesn't work with use_frameworks #19105

AndrewJack opened this issue Sep 14, 2022 · 10 comments
Assignees

Comments

@AndrewJack
Copy link

Summary

On iOS when using use_frameworks (static or dynamic) in the pod file with expo document-picker on iOS v13.7 or older the app will crash on startup with the below stacktrace:

dyld: Library not loaded: /System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers

Combination which causes the crash:

  • Expo 46 (may also crash on older sdks)
  • use_frameworks setting as "ios.useFrameworks": "static" or "ios.useFrameworks": "dynamic"
  • iOS 13.7 or older (tested on v13.7 & v12.4)
  • Expo document-picker installed

I think it's related to the __IPHONE_OS_VERSION_MAX_ALLOWED check not working, but not sure -

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000

What platform(s) does this occur on?

iOS

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 12.5.1
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.20.0 - ~/.nvm/versions/node/v14.20.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.20.0/bin/yarn
npm: 6.14.17 - ~/.nvm/versions/node/v14.20.0/bin/npm
Watchman: 2022.09.12.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /Users/andrew/.rvm/gems/ruby-2.7.4/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 29, 30, 31, 32
Build Tools: 28.0.3, 29.0.2, 30.0.2, 33.0.0
System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
npmPackages:
expo: ~46.0.9 => 46.0.10
react: 18.0.0 => 18.0.0
react-dom: 18.0.0 => 18.0.0
react-native: 0.69.5 => 0.69.5
react-native-web: ~0.18.7 => 0.18.9
Expo Workflow: bare

Minimal reproducible example

  1. Checkout repo - https://github.com/AndrewJack/expo-doc-picker-ios-crash
  2. yarn install
  3. npx pod-install
  4. Open Xcode
  5. Run on ios 13.7 or older simulator

Expected: app runs without crashing
Actual: App crashes on launch with the error above.

@AndrewJack AndrewJack added the needs validation Issue needs to be validated label Sep 14, 2022
@Mfweb
Copy link

Mfweb commented Dec 9, 2022

the same issue.

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: DYLD 1 Library missing
Library not loaded: /System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers
Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/E0C6E087-E808-41A9-8FE1-057773356837/data/Containers/Bundle/Application/8C2EE3EB-903E-47DF-AF1B-9CA8F6FF5A60/app.app/app
Reason: image not found
(terminated at launch; ignore backtrace)

@brentvatne brentvatne added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Feb 22, 2023
@murat0
Copy link

murat0 commented Mar 13, 2023

+1 We are experiencing the exact same issue except that we don't have document picker installed. It must be another expo or react-native library causing the issue. Build works fine on iOS 14,15,16 but fails to launch on iOS 13.

Any suggestions to check if a library is related to "/System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers" ?

@Mfweb
Copy link

Mfweb commented Mar 13, 2023

Manually add UniformTypeIdentifiers.framework to solve this problem.

const plugs = require('expo/config-plugins');

module.exports = function withUniformTypeIdentifiers(c) {
    return plugs.withXcodeProject(c, (config) => {
        const target = plugs.IOSConfig.XcodeUtils.getApplicationNativeTarget({
            project: config.modResults,
            projectName: config.modRequest.projectName,
        });
        config.modResults.addFramework("UniformTypeIdentifiers.framework", { target: target.uuid, weak: true });
        return config;
    });
}

@AndrewJack
Copy link
Author

I can't reproduce this with Expo 48 & Xcode 14.2 anymore. However I'm not sure what the fix is.

@irisjae
Copy link

irisjae commented Mar 27, 2023

Just leaving my experience here in case anyone finds it helpful; Xcode 14.2 and Expo 48 did not solve the issue for me, but @Mfweb 's patch works.

@mhammerc
Copy link
Contributor

@Mfweb plugin works. Thank you!

@brentvatne brentvatne removed the needs review Issue is ready to be reviewed by a maintainer label Apr 12, 2023
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@RGDEV2022
Copy link

RGDEV2022 commented Apr 14, 2023

Manually add UniformTypeIdentifiers.framework to solve this problem.

const plugs = require('expo/config-plugins');

module.exports = function withUniformTypeIdentifiers(c) {
    return plugs.withXcodeProject(c, (config) => {
        const target = plugs.IOSConfig.XcodeUtils.getApplicationNativeTarget({
            project: config.modResults,
            projectName: config.modRequest.projectName,
        });
        config.modResults.addFramework("UniformTypeIdentifiers.framework", { target: target.uuid, weak: true });
        return config;
    });
}

I'm facing the same issue. Could you please explain how to set this up?
So you would still setup useFrameworks: static in the app.json plugins section -> create a new my-plugin.js in the root with the plugin you have here with UniformTypeIdentifiers.framework and then add that into the plugins array in app.json as well?

Haven't been able to get it working for me

  "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ],
      ["./my-plugin", "fix"]
    ]

@Mfweb
Copy link

Mfweb commented Apr 15, 2023

Manually add UniformTypeIdentifiers.framework to solve this problem.

const plugs = require('expo/config-plugins');

module.exports = function withUniformTypeIdentifiers(c) {
    return plugs.withXcodeProject(c, (config) => {
        const target = plugs.IOSConfig.XcodeUtils.getApplicationNativeTarget({
            project: config.modResults,
            projectName: config.modRequest.projectName,
        });
        config.modResults.addFramework("UniformTypeIdentifiers.framework", { target: target.uuid, weak: true });
        return config;
    });
}

I'm facing the same issue. Could you please explain how to set this up? So you would still setup useFrameworks: static in the app.json plugins section -> create a new my-plugin.js in the root with the plugin you have here with UniformTypeIdentifiers.framework and then add that into the plugins array in app.json as well?

Haven't been able to get it working for me

  "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ],
      ["./my-plugin", "fix"]
    ]

app.config.js:

        plugins: [
            // ....
            ["./withUniformTypeIdentifiers.js"]
        ]

For more information, check here:
https://docs.expo.dev/config-plugins/plugins-and-mods/

@RGDEV2022
Copy link

RGDEV2022 commented Apr 18, 2023

@Mfweb This doesn't seem to work for me. The issue I'm having is setting useFrameworks: static (to get firebase analytics working) creates an issue with the navigation stack. Where you can only switch to one screen, and if you go back to your previous screen the app just gets stuck. This only happens when setting useFrameworks: static

Also wanted to add that this is only seen in the production build, not development.

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

No branches or pull requests

9 participants