react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.33k stars 434 forks source link

Unable to build 9.0.0 and up due to undefined symbols on ios #713

Closed jpancotti closed 2 months ago

jpancotti commented 2 months ago

Env: ios: 17.0 "react": "18.2.0", "react-native": "0.72.7", "react-native-document-picker": "9.0.0^",

Undefined symbol: _UTTypeCopyPreferredTagWithClass Undefined symbol: _UTTypeCreatePreferredIdentifierForTag Undefined symbol: _kUTTagClassFilenameExtension Undefined symbol: _kUTTagClassMIMEType

I have tried cleaning the build resetting yarn cache and linking unified type identifiers framework

vonovak commented 2 months ago

Hello and thanks for asking, unfortunately, I don't remember getting such error when I last built the example project. My advice would be to try the sponsor-only package https://react-native-documents.github.io/docs/install . It's a new rewrite which uses Swift and I think there's a good chance it will work. You can get it for $29 if you sponsor monthly (edit: after you sponsor, you get to keep the last version released during sponsorship forever; monthly sponsorship is not required) and I'll give you the money back if you show me that the same issue is there as well.

Thank you 🙂

jpancotti commented 2 months ago

When was the last time you built the example project? Because it appears to be based on 8.2.0, and this issue is only with 9.0.0 and up. https://github.com/react-native-documents/document-picker/blob/23ce0d2de4cfb2b1f1868f4afd9bbe466127fe6c/example/ios/Podfile.lock#L300

Nice try with the paywall, very helpful. Just infinite easy payments of $29 a month and theres a 'good chance' the library will work? I reached for my wallet so fast I think I tore my rotator cuff.

Hello and thanks for asking, unfortunately, I don't remember getting such error when I last built the example project. My advice would be to try the sponsor-only package https://react-native-documents.github.io/docs/install . It's a new rewrite which uses Swift and I think there's a good chance it will work. You can get it for $29 if sponsor monthly and I'll give you the money back if you show me that the same issue is there as well.

Thank you 🙂

vonovak commented 2 months ago

When was the last time you built the example project? Because it appears to be based on 8.2.0, and this issue is only with 9.0.0 and up.

https://github.com/react-native-documents/document-picker/blob/23ce0d2de4cfb2b1f1868f4afd9bbe466127fe6c/example/ios/Podfile.lock#L300

Nice try with the paywall, very helpful. Just infinite easy payments of $29 a month and theres a 'good chance' the library will work? I reached for my wallet so fast I think I tore my rotator cuff.

Hi! The information stored in the lockfile is read from package.json at the time pod install is executed. So what can happen (and happened) is that you run pod install (v8 goes into the lockfile), then do a bunch of development and release v9. But example's lockfile stays as it was. v9 was definitely built and tested before released (and was downloaded 84k times in the last week).

Nice try with the paywall, very helpful. Just infinite easy payments of $29 a month and theres a 'good chance' the library will work?

You can buy it for $29 and then keep that package version forever. After sponsorship ends, you'll only lose access to updates, but the package is already fairly feature-complete. I said 'good chance' simply because I cannot make a guarantee. I've been doing OSS without compensation for years (wouldn't always call it 'easy'), and decided I wanted to get compensated for the work I do. I don't think there's anything wrong about that, and if you don't want to give the paid version a try, that's fine 🙂 . I wasn't very clear about the monthly sponsorship so sorry about that.

jpancotti commented 2 months ago

I solved the build errors by adding the following to my podfile

    installer.generated_projects.each do |project|
      project.build_configurations.each do |config|
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)'] 
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '$(SDKROOT)/System/Library/Frameworks' 
        config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)', '-framework MobileCoreServices'] 
      end
      project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)'] 
          config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '$(SDKROOT)/System/Library/Frameworks' 
          config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)', '-framework MobileCoreServices'] 
        end
      end
    end

This should solve #685 as well.

vonovak commented 2 months ago

Hello, can you please check if adding s.frameworks = 'MobileCoreServices'

to the podspec helps?

(re-run pod install after the change).

Thank you!

jpancotti commented 2 months ago

Yes. This change solves the issue without the changes in my previous comment. I double checked by reverting it and the issue came back.

PR #715 sent.