kmn
kmn

Reputation: 2655

Cannot load underlying module for 'Charts'

I'm just getting started with the iOS charts library :

--> in ViewController.swift: the line import Charts gives an error: Cannot load underlying module for 'Charts'

Why is that ?

Thank you !

Upvotes: 2

Views: 4670

Answers (7)

Ryan Duell
Ryan Duell

Reputation: 182

Make sure your scheme is targeting an iOS device or simulator. If you build for your Mac it'll give you this error.

Upvotes: 0

Nupur Sharma
Nupur Sharma

Reputation: 1214

Build the project and this error will go away

Upvotes: -2

Jayprakash Dubey
Jayprakash Dubey

Reputation: 36447

I had the same issue with KeychainAccess pod. Even though the pod was installed it use to throw an error

‘Cannot load underlying module for KeychainAccess’.

The fix that worked for me :

  1. Uninstall the pod and install it again
  2. Delete the derived data content
  3. Quit Xcode and start again

Upvotes: 0

Max Phillips
Max Phillips

Reputation: 7499

After cleaning the product once I received this error. I then removed the framework from embedded binaries, cleaned the product, then added it once more to embedded libraries. I then built the product and retried the import statement. The import statement worked.

Upvotes: 0

Nick Podratz
Nick Podratz

Reputation: 682

The answer comes a bit late, but what solved the problem for me was to clean my project by selecting the option Product > Clean from my status bar. Hope it might help someone else in case you solved the problem already.

Upvotes: 1

daniel.gindi
daniel.gindi

Reputation: 3496

It's possibly related to this issue too: https://github.com/Alamofire/Alamofire/issues/122

In short: Seems like there's a bug in Xcode 6.3.1, where new projects have problems when importing Embedded Frameworks. In such a case, you need to let the project build first, and then add the framework to the project.

Upvotes: 4

ClockWise
ClockWise

Reputation: 1519

Sounds like your project haven't added the framework successfully. I just started with ios-charts as well, and I followed the steps on github as well and it worked like a charm. What I did was to just drag the Charts.xcodeproj into my Project Navigator and it worked like a charm. If this doesn't work for you, however, make sure you are using iOS 8. If you are not, then you have to add the .swift-files to your project. If you are using iOS 8 and the approach still doesn't work, I'd try to install it using CocoaPods instead. I'm fairly new in CocoaPods so can't really help you there, but just google on how to install frameworks using CocoaPods and you should find what you seek.

Sorry if I wasn't of much help!

Upvotes: 1

Related Questions