iOS Build Error

Getting iOS build error: web3auth-swift-sdk/Sources/Web3Auth/Web3Auth.swift:49:86 Missing argument for parameter ‘origin’ in call. Any help appreciated.
Env: Xcode 16 on Silicon Mac; Web3Auth SDK 9.0.0

Hi Srini,

Thanks for providing the detailed information about your issue.

It looks like you are facing an iOS build error with the PnP iOS SDK, specifically on the Web3Auth.swift file at line 49. The error is Missing argument for parameter 'origin' in call.

From the information provided:

  • SDK: PnP iOS SDK
  • SDK Version: 9.0.0
  • Platform: Xcode 16 on Silicon Mac
  • Error Details: web3auth-swift-sdk/Sources/Web3Auth/Web3Auth.swift:49:86 Missing argument for parameter 'origin' in call

Could you please share the relevant initialization and login code snippets of your Web3Auth integration within your project? This will help us better understand how the parameters are being passed and diagnose the issue more effectively.

Additionally, if you have any browser console screenshots or logs that might provide more context, they would be very helpful.

This response was generated by the Web3Auth Bot, and a member of our Web3Auth team will follow up shortly to assist you further.

Thank you!

init and login code snippets:

func setup() async {
    guard web3Auth == nil else { return }
    await MainActor.run {
        isLoading = true
    }
    do {
        web3Auth = try await Web3Auth(W3AInitParams(clientId: clientId, network: network, redirectUrl: origin))
    } catch {
        print("Error initializing Web3Auth")
    }
    await MainActor.run {
        if self.web3Auth?.state != nil {
            user = web3Auth?.state
            loggedIn = true
        }
        isLoading = false
    }
}

func login(provider: Web3AuthProvider) {
    Task {
        do {
            let result = try await web3Auth?.login(W3ALoginParams(loginProvider: provider))
            await MainActor.run {
                user = result
                loggedIn = true
            }
        } catch {
            print("Login Error")
        }
    }
}

Hey, I went through the code, the code looks fine to me apart from the redirect url. What’s the origin that you are passing in redirect url? I checked the codebase, on that line we are calling the session manager.

Can you also pin point when the error is triggered in the code snippet you shared. During the initialisation, or during login.

its failing in iOS build process.

Can you share the details I asked above to help me debug?

origin value as app bundle id: com.cv.w3auth://auth.
see below for actual line of code: private var origin = “com.cv.w3auth://auth”
Can we pls connect over zoom to work through the issue?

You can join our office hours, Every Tuesday, 2:30 PM SGT(UTC +8)

Ayush, figured out the issue with session manager version. Build is good with v4.0.2 but web3auth v9.0 is pulling session manager v4.1.0.

Thanks for informing, let me check if we are doing exact dependencies or not in SDK.

Im facing the same issue on iOS, has this been resolved?

hey srini, what changes did you make for the build to run?

Will we get any support for this? The iOS SDK is not compiling…

yes. use ‘exact’ version as the sdk spm pulling latest version and there is a conflict with session manager version. sample: .package(url: “GitHub - Web3Auth/web3auth-swift-sdk”, exact: “9.0.0”),
.package(url: “GitHub - Web3Auth/session-manager-swift”, exact: “4.0.2”),
.package(url: “GitHub - attaswift/BigInt: Arbitrary-precision arithmetic in pure Swift”, exact: “5.3.0”),

Hey we have informed the team, we’ll push a fix for the issue where it uses exact version.

Hey this issue is fixed in the latest version(v9.0.1). Please let us know if you are still facing the issue.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.