openid / AppAuth-iOS

iOS and macOS SDK for communicating with OAuth 2.0 and OpenID Connect providers.

Home Page:https://openid.github.io/AppAuth-iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to add AppAuth as a dependency in a SPM package

Lapinou42 opened this issue · comments

Describe the bug
When trying to add the AppAuth-iOS dependency to a Swift library via Swift Package Manager, I get an error stating "product 'AppAuth' required by package 'mypackage' target 'MyPackage' not found." despite the presence of AppAuth as a product in the AppAuth-iOS package definition.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Swift library using Swift Package Manager (swift package init --type library)
  2. Add .package(url: "https://github.com/openid/AppAuth-iOS.git", from: "1.6.2") to the dependencies in the Package.swift file.
  3. Add "AppAuth" to the dependencies of the target.
    .target( name: "MyPackage", dependencies: ["AppAuth"] ),
  4. Try building the library or fetching the dependencies.
  5. Observe the mentioned error.

Expected behavior
I expect the AppAuth-iOS library to be successfully added as a dependency and to be available for use in the Swift library..

Environment

  • Device: Any devices
  • OS: iOS 16.5
  • Browser: /

Additional context
I've noticed that AppAuth-iOS has its source files in a "Source" directory as opposed to the typical "Sources" directory. I'm not sure if this might be the root of the problem (should not). Also, I've tried referencing the library both from its GitHub URL and from a local path to try debugging but no solution found.

I think you have an issue in your Package.swift. I was not able to reproduce this. Take a look at this example of depending upon AppAuth-iOS in GoogleSignIn-iOS: declaring the dependency, and depending upon it in a target.

I have some screenshots below from a small sample project. This library builds fine (the warning in the second screenshot is from not doing anything with the instantiated OIDAuthorizationRequest).

Screenshot 2023-08-17 at 9 55 19 AM
Screenshot 2023-08-17 at 9 58 49 AM

@mdmathias Oh 😦
My others dependencies are registered like this :

.target( name: "MyPackage", dependencies: ["AppAuth"] )

So to fix that, just renamed like in your screenshot works ! Maybe because the name of your product is different of the name of your package… Good to know :)

anyway, many thanks for the quick feedback ❤️

No problem!