vapor / apns

Helpful extensions and abstractions for using APNSwift
MIT License
115 stars 30 forks source link

APNS package not found #53

Closed nicolassrod closed 10 months ago

nicolassrod commented 10 months ago

Describe the bug

When I tried to use the package from a clean project I get this error product 'APNS' required by package 'hello' target 'AppTests' not found in package 'apns'.

To Reproduce

I am using steam project generator 4.83.1, just use apns package

// swift-tools-version:5.9
import PackageDescription

let package = Package(
    name: "hello",
    platforms: [
       .macOS(.v13)
    ],
    dependencies: [
        // 💧 A server-side Swift web framework.
        .package(url: "https://github.com/vapor/vapor.git", from: "4.83.1"),
        .package(url: "https://github.com/vapor/apns.git", from: "4.0.0"),
    ],
    targets: [
        .executableTarget(
            name: "App",
            dependencies: [
                .product(name: "Vapor", package: "vapor"),
                .product(name: "APNS", package: "apns"),
            ]
        ),
        .testTarget(name: "AppTests", dependencies: [
            .target(name: "App"),
            .product(name: "XCTVapor", package: "vapor"),

            // Workaround for https://github.com/apple/swift-package-manager/issues/6940
            .product(name: "Vapor", package: "vapor"),
            .product(name: "APNS", package: "apns"),
        ])
    ]
)

Expected behavior

A clear and concise description of what you expected to happen.

Environment

vzsg commented 10 months ago

In the latest version (v4), the target of this package has been renamed from ~APNS~ to VaporAPNS, hence the error you're getting. Change your dependency declarations in both the app and the test targets to:

.product(name: "VaporAPNS", package: "apns"),

...and the error should go away.

nicolassrod commented 10 months ago

Yes, that worked, I think I think you will have to update the documentation, according to that we have to use a version that does not exist (5.0.0) https://docs.vapor.codes/advanced/apns/

0xTim commented 10 months ago

Resolved with https://github.com/vapor/docs/pull/943