Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Symbols when importing with SwiftPM #72

Open
Mordil opened this issue Jun 30, 2021 · 1 comment
Open

Undefined Symbols when importing with SwiftPM #72

Mordil opened this issue Jun 30, 2021 · 1 comment

Comments

@Mordil
Copy link

Mordil commented Jun 30, 2021

Xcode 2.5 (12E262)
Swift 5.4
SwiftPM - Xcode's Bundled version
Project Minimum iOS Version: 13

filestack-ios: 2.7.2

When importing the library using Xcode's UI for adding Swift Packages to our iOS Target, we add the following code:

import Filestack
import FilestackSDK

extension ViewController {
  private func doSomething() {
    let client = Client(apiKey: "")
    print(client)
  }
}

when we build, Xcode gives us the following errors:

Undefined symbols for architecture arm64:
  "type metadata accessor for FilestackSDK.Client", referenced from:
      Peek_Pro.PKViewOrderViewController.(doSomething in _0192BE462E8B9F880CB09CA425A161D1)() -> () in PKViewOrderViewController.o
  "FilestackSDK.Client.__allocating_init(apiKey: Swift.String, security: FilestackSDK.Security?) -> FilestackSDK.Client", referenced from:
      Peek_Pro.PKViewOrderViewController.(doSomething in _0192BE462E8B9F880CB09CA425A161D1)() -> () in PKViewOrderViewController.o
ld: symbol(s) not found for architecture arm64

Undefined symbol: type metadata accessor for FilestackSDK.Client
Undefined symbol: FilestackSDK.Client.__allocating_init(apiKey: Swift.String, security: FilestackSDK.Security?) -> FilestackSDK.Client

I've narrowed it down to only receiving build errors when importing FilestackSDK, importing Filestack itself is fine

@rnine
Copy link
Contributor

rnine commented Jul 1, 2021

Hmm, I see what's going on:

BothFilestackSDK and Filestack define the symbol Client and because both Filestack and FilestackSDK are being imported in your code, Client is being resolved to FilestackSDK.Client and it is failing to build since your target is not linking explicitly against FilestackSDK.

To resolve this issue, you may want to:

  1. Add the FilestackSDK (https://github.com/filestack/filestack-ios.git) dependency explicitly to your target.
  2. Make sure to prefix the Client class with either Filestack. or FilestackSDK. depending on what Client class you intend to use.

Let me know if this works for you and we'll add this extra step to our SPM installation procedure in the README.md.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants