akaffenberger / firebase-ios-sdk-xcframeworks

A small mirror for https://github.com/firebase/firebase-ios-sdk, to add support for binary (xcframework) distribution with swift package manager.
MIT License
134 stars 32 forks source link

No such module 'xxx' errors. #41

Closed kamimi01 closed 1 year ago

kamimi01 commented 1 year ago

Hi, @akaffenberger Thank you for creating a great library!

I'm new to Swift Package. I'm stuck on the following problems. Would you mind telling me how to fix them?

Description

I've got No such module 'xxx' errors.

image

I think the cause is my project can't get source files from firebase-sdk-ios because there is still a dummy file in each product in the following screenshot. I know package.sh will get those files, but I don't understand how I should run that script. (Copy the script into my project and run it?)

image

What I did

image

Here is my package.swfit.

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "FirebaseSDK",
    platforms: [.iOS(.v11)],
    products: [
        .library(name: "FirebaseSDK", targets: ["FirebaseSDK"])
    ],
    dependencies: [
        .package(
            name: "Firebase",
            url: "https://github.com/akaffenberger/firebase-ios-sdk-xcframeworks.git",
            .exact("9.5.0")
        ),
    ],
    targets: [
        .target(
            name: "FirebaseSDK",
            dependencies: [  // products that I want to use
                .product(name: "FirebaseAnalytics", package: "Firebase"),
                .product(name: "FirebaseAuth", package: "Firebase"),
                .product(name: "FirebaseFirestore", package: "Firebase"),
                .product(name: "FirebaseCrashlytics", package: "Firebase"),
                .product(name: "GoogleSignIn", package: "Firebase")
            ]
        )
    ]
)

image

image

akaffenberger commented 1 year ago

Hi @kamimi01! Based on the screenshots, it looks like you're trying to use this package with your DivingTips XCode project. XCode has SPM built-in, so you do not need to create a Package.swift file.

Click on your DivingTips project, the root folder:

Screen Shot 2022-10-05 at 8 06 43 PM

Then you should see a list of all your targets underneath "TARGETS", and your project underneath "PROJECT". Click on the project. Then click on the "Package Dependencies" tab and add this package with the '+' sign at the bottom.

Screen Shot 2022-10-05 at 8 26 19 PM

Make sure you select all the libraries you want to use. In your case select "GoogleSignIn".

Screen Shot 2022-10-05 at 8 26 00 PM

You should be good to go from there.

If you need to further troubleshoot, you can also check which libraries are included if you go to Targets -> DivingTips -> General -> Frameworks, Libraries and Embedded Content. You want to see GoogleSignIn in the list, if it's not there you can add it via the '+' sign:

Screen Shot 2022-10-05 at 8 23 46 PM

Also, to further clarify what this project is doing -- the package.sh script you mentioned is not meant to be used externally, it is a script this project uses internally (it pulls down the latest Firebase binaries, generates the Package.swift file for this repo, and then uploads the binaries to this repo). You don't need to worry about running that.

If you are still having issues or have any other questions don't hesitate to ask!