vtourraine / AcknowList

Acknowledgements screen displaying a list of licenses, for example from CocoaPods and Swift Package Manager dependencies.
MIT License
784 stars 59 forks source link

AcknowList 2.1.1 not working in a pure SPM project #103

Closed hdmdhr closed 2 years ago

hdmdhr commented 2 years ago

My project is not using CocoaPods (so I do NOT have a .xcworkspace file), all third party frameworks are added from SPM. And I strictly followed the installation instructions for SPM:

  1. Click on File → Add Packages….
  2. Enter https://github.com/vtourraine/AcknowList.
  3. Select the version you’d like to use.
  4. Add the Package.resolved file generated by Xcode to your main target: drag and drop the file from the [appName].xcodeproj/project.xcworkspace/xcshareddata/swiftpm/ folder to your Xcode project (don’t copy the file, leave Copy items if needed unchecked).

I drag & dropped Package.resolved to my project (did not copy item as the instructions suggest) image

And it is checked for my main target: image

And my usage:

    func showAcknowList() {
        let vc = AcknowListViewController()
        navigationController.present(vc, animated: true)
    }

Then in the console log I saw

No acknowledgements found. This probably means that you didn’t import the Pods-acknowledgements.plist to your main target.

I tried with other initializer such as init(plistPath: String) & init(fileNamed: String) but I got no luck. I briefly checked the source code for these initializers, and it seems they are all looking for a file with ".plist" extension instead of "Package.resolved".

Also it seems the initializer init(plistFileURL: URL) documented in README is no longer available.

I am using AcknowList 2.1.1 image

Did I miss any step? How can I make AcknowList work with SPM?

vtourraine commented 2 years ago

Thank you for your feedback!

The problem here is that you’re using the latest “tagged” release (version 2.1.1), but the Package.resolved code hasn’t been included yet. It’s available on the main branch, so you see it in the documentation by default when you browse the repo on GitHub. Sorry for the confusion! It will be part of the next major release (version 3.0.0).

When you import the AcknowList package (step 3, in the instructions you mentioned above), you can choose a branch instead of a version number. That will give you the Package.resolved code. Please let me know if that works, thanks!

hdmdhr commented 2 years ago

Hi Vincent, thank you for your prompt response!

And yes! With your suggestion, I managed to make AcknowList work with SPM! All I did was to use main branch instead of version as you suggested, and it worked!

image

Thanks a lot for your help, and hope your next major release go smoothly!

vtourraine commented 2 years ago

Awesome, thank you for the confirmation! And please let me know if you have any suggestions or ideas regarding the SPM Packages support. It’s always easier to change things before it gets included in a public release.