pdftron-react-native icon indicating copy to clipboard operation
pdftron-react-native copied to clipboard

Builds fails when new PDFNet version is available

Open henninghall opened this issue 1 year ago • 2 comments

Describe the bug

When a new version of PDFNet is available, a build that previously succeeded now fails. This happens because PDFNet podspec points towards https://pdftron.com/downloads/ios/react-native/latest.podspec which changes sometimes.

target 'MyApp' do
    # ...
    pod 'PDFNet', podspec: 'https://pdftron.com/downloads/ios/react-native/latest.podspec'
    # ...
end

Expected behavior I expect the locked dependencies to be locked into a specific version. When updating PDFTron I expect the PDFNet version to be updated to the latest version you support.

Screenshots Screenshot 2022-08-23 at 10 47 29

Stacktrace

[!] CocoaPods could not find compatible versions for pod "PDFNet": In snapshot (Podfile.lock): PDFNet (from `https://pdftron.com/downloads/ios/react-native/latest.podspec`) In Podfile: PDFNet (from `https://pdftron.com/downloads/ios/react-native/latest.podspec`) It seems like you've changed the version of the dependency `PDFNet` and it differs from the version stored in `Pods/Local Podspecs`. You should run `pod update PDFNet --no-repo-update` to apply changes made locally.

Questions

  1. Is there a way around this?
  2. Would you consider locking down the PDFNet version instead of pointing to a moving target?

Thanks!

henninghall avatar Aug 23 '22 09:08 henninghall

Hi there, We do offer versioned CocoaPod podspecs for each release if you would prefer: https://www.pdftron.com/documentation/ios/get-started/integration/cocoapods/#option-2

eg. https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdfnet/9.3.0.80119.podspec

When you are building your project and running into the pod version issue, what command are you running?

I think the Pods/Local Podspecs cache in your project should have a local copy of the PDFNet podspec that matches the version in your Podfile.lock file. You may need to consult the CocoaPods documentation on how this is supposed to work though.

dluco avatar Aug 26 '22 18:08 dluco

Thanks for your answer!

We do offer versioned CocoaPod podspecs for each release if you would prefer: https://www.pdftron.com/documentation/ios/get-started/integration/cocoapods/#option-2

Oh that's nice! That would work better, but how do we know when to bump that version? When you release a new pdftron-react-native version, can we assume the latest PDFNet version works with that?

When you are building your project and running into the pod version issue, what command are you running?

I run pod install. When this error happens it was possible to bump version by running pod update PDFNet --no-repo-update which was suggested in the error message. This doesn't really help though, maybe we don't want to upgrade at that time, or this could happen on CI (which was our original problem).

I think the Pods/Local Podspecs cache in your project should have a local copy of the PDFNet podspec that matches the version in your Podfile.lock file. You may need to consult the CocoaPods documentation on how this is supposed to work though.

I definitely don't have that much knowledge about CocaoPods so that could definitely be the case 😅 But that still wouldn't help for new developers / CI if I understand correctly.


Suggestion

I've researched this a bit and found that some projects, including react-native project itself, seem to solve this issue by having multiple .podspec files in the same project. In your case it would mean adding a PDFNet.podspec next to the RNPdftron.podspec. That would be very convenient for us who uses the lib since we don't have to add this line

pod 'PDFNet', podspec: 'https://pdftron.com/downloads/ios/react-native/latest.podspec'

to our Podfile, we won't have the issue I ran into here and you get the control of pinning a specific PDFNet version to a specific pdftron-react-native version.

That would mean that you have to update the PDFNet.podspec file when you make a new release of pdftron-react-native. I don't know how your workflow works and if this would be an option for you?

henninghall avatar Aug 30 '22 06:08 henninghall