RevenueCat / purchases-ios

In-app purchases and subscriptions made easy. Support for iOS, watchOS, tvOS, macOS, and visionOS.
https://www.revenuecat.com/
MIT License
2.36k stars 319 forks source link

SPM install takes forever #3771

Closed pnome closed 6 months ago

pnome commented 7 months ago

Whenever I do "Update to latest package versions" in Xcode (15.3), purchases-ios takes an extremely long time, and sometimes doesn't complete. This has been happening to me for a while over multiple Xcode versions.

I have 20 Swift Packages in my project and none of the others have issues.

The following happens with purchases-ios nearly every time...

  1. It says "fetching purchases-ios" and quite quickly gets to 44%.
  2. It then crawls up to 45%, 46% over the next 5 or so minutes.
  3. Sometimes, if I leave it for 10 minutes, it finally completes.

I don't know what to do about this, but it can stop me working for hours at a time if I need to refresh packages for some reason. I can't build anything while it's in that state.

I sometimes see this error, but I can only assume it's because it didn't manage to fetch properly: Failed to resolve dependencies Dependencies could not be resolved because no versions of 'purchases-ios' match the requirement 4.39.0.<5.0.0 and root depends on 'purchases-ios' 4.39.0…<5.0.0.

RCGitBot commented 7 months ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

michaelAtRC commented 7 months ago

Hey @pnome !

When you install the SDK, you will want to set the Dependency Rule to Up to next major, and the version number to 4.0.0 < 5.0.0. When "Choose Package Products for purchases-ios" appears, Xcode adds all libraries to your target by default. Select "None" for RevenueCat_CustomEntitlementComputation and ReceiptParser.

Can you please verify that you have done the following and let me know if that helps?

pnome commented 7 months ago

Thanks. That's how I had it set. Weirdly, everything is fine today. it's instant. Very strange.

aboedo commented 7 months ago

@pnome I'm actually running into this right now. It seems like an Xcode 15.3 or sonoma 14.4 bug, but I'm not sure yet. Quite annoying in that there isn't much in the way of information coming from xcode either.

aboedo commented 7 months ago

Looks like xcode is picking up the entire repo's history, which includes every snapshot in UI tests, when checking out the SPM package. We're looking into ways of solving it

artem-tverdokhlebov commented 7 months ago

@aboedo Hi! Others already solved this problem like this: https://github.com/airbnb/lottie-spm https://github.com/OneSignal/OneSignal-XCFramework

aboedo commented 7 months ago

@artem-tverdokhlebov thanks for sending those over! We'll take a look at the approaches, there are some pros and cons for each but either one would help us solve the problem.

LouisBensard commented 7 months ago

Same problem here. Takes hours for me to re-install purchases-ios package. Same behavior being stuck at 44%, 45%, 46%.

Lontronix commented 6 months ago

Any updates on this? This is an incredibly frustrating issue :(

TechD-Robin commented 6 months ago

Maybe has same problem; when I update SPM's third party libraries, progress always hold at purchases-ios. And try to clear DerivedData, remove SPM setting & re-add, ... problem has not be solved.

MacOS : 14.4.1 XCode : 15.3

andrei200287 commented 6 months ago

Any news?

pnome commented 6 months ago

Strangely, I haven't been experiencing the issue lately. I have no idea why. I had to clean the build folder and delete derived data just today, and it didn't take long to update to the latest package versions. The issue has been on and off for me over the years.

MathisDetourbet commented 6 months ago

Same issue here

jamesrb1 commented 6 months ago

Hello all, thank you for letting us know about this problem.

We have a set up a mirror repo, purchases-ios-spm, that is much faster to integrate via SPM than the main iOS repo.

Could you please try integrating with it, and let us know if you see a huge improvement in the time it takes to add/update the package?

Thank you!

MathisDetourbet commented 6 months ago

Seems to work great. Thanks 🙏

vegaro commented 6 months ago

Great to hear! I will close this issue then, let us know if you have any future issue with it

Thanks for your patience by the way!

github-actions[bot] commented 6 months ago

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.