Unable to use Charts framework in Xcode - ios

I installed Charts via cocoapods to an Xcode project but I get the following errors on building it: 'No such module Charts' and 'ChartPlatform.swift : Method does not override any method from its superclass'.
I made sure to uncomment 'use_frameworks', in the podfile and open the project using the xcworkspace file. Not sure where I went wrong. I've always installed pods the same way and haven't had problems till today.
How can I fix this?

I ran into the same problem because I was using an older version of Xcode. The Charts framework only works with Xcode 8 and swift versions 2.3 or 3.0. Try updating and see if that fixes the issue.

In my case I just removed Charts.framework from Embedded Binaries and then added again rebuild the project (Cmd+B) the error has gone.

Related

Importing AudioKit framework gives "'x' is not a member type of 'AudioKit' errors

I've been trying to add AudioKit to a project in Xcode to no avail - even blank projects created just to import AudioKit into my View Controller are throwing 2711 errors, mostly saying "'x' is not a member type of 'AudioKit', "Initializer does not override a designated initializer from its superclass", and "Method does not override any method from its superclass".
I'm trying to add AudioKit by directly adding the frameworks to the project as recommended by this video https://www.youtube.com/watch?v=iUvWxWvRvo8&feature=youtu.be, adding appropriate Framework Search Paths and Linker Flags to the build target.
I've read that these errors can be thrown by types and frameworks having the same name, and AudioKit contains a header file called "AudioKit.h". Changing the name of this throughout AudioKit didn't help, however, and the import AudioKit line started giving me a 'No Such Module (changed name)' error rather than the usual 'Failed to load AudioKit'. Changing the name of the framework as a whole had the same effect.
Is this an issue I can solve or something specific to AudioKit? I'm running Catalina 10.15.3. and have been able to install other frameworks via CocoaPods, but that didn't work for AudioKit. It's like pulling teeth here, I'd be grateful for input from anyone with the same issue.
These are the errors I'm being shown:
EDIT: Airdropping my project file onto a different Mac and compiling worked absolutely fine with Audiokit, so I've got no idea what the issue is.
Hi #Jowan and future readers, I had the same issue and found that it's best to stick with cocoapods, here's a working version for the latest ios and swift 5.2:
platform :ios, '11.0'
target 'AKRecorder' do
use_frameworks!
pod 'AudioKit', '~> 4.9.5'
end
I've reported the issue here if you want to take a look in other steps I took (How to include Audiokit 4 in a new project xcode 11 and swift 5.1?)
Good luck!
This issue also happened to me a week ago (my post: AudioKit Playground Builds fail) and the reason why it was brining up these errors, was because I didn't have the newest version of Xcode and AudioKit 4.9.5 only seems to work with the newest version of Xcode. To fix this error, you either need to update your Xcode, or download older version of AudioKit (what I did). To download the older version of AudioKit you can go to this website https://github.com/audiokit/AudioKit/releases and open the older AudioKit version assets, or you can to download it through cocoapods, you will need to write (pod 'AudioKit', '4.9.4') or a different version, in the pod file.

Xcode 10 convert to Swift 4.2 fails

I am getting this error trying to migrate to Swift 4.2 using the Xcode provided conversion tool. How do I fix it? The code builds fine otherwise.
Do you have any libraries in your project? I think you are trying to covert your project with dependencies and there are problems in them with new swift version. Try to uncheck all dependencies except your project and convert to new version of Swift
I had similar problem, solved it by
1- Change swift lang version in build setting of all app and test targets to 4.2
2- build app, errors will happen like UIControlState renamed to UIControl.state
3- fix all of the build errors
4- I updated all recommended settings by xcode
5- then I asked xcode to convert to swift4.2
It's always a good idea to upgrade all dependencies (e.g. via Cocoapods) to its latest version that support Swift 4.2. In my case, I also need to manually change the Swift Language Version build settings for a pod library from Swift 4 to Swift 4.2 as that lib uses some APIs in 4.2 only.
I have problem too. I find solution to fix this problem in web
https://ericasadun.com/2018/09/13/converting-projects-by-hand-to-4-2/
First
You try delete pod in pod file and install pod again and pod update in your folder project in command then conversion to Swift 4.2.
if it's not work do this in second.
Second
you try follow do this picture in build setting project or try follow do in link web.
As described here,
There may have been issues with processing the targets that will
negatively impact the migration process. Switch to the Report
Navigator and select the Convert entry that was added; this is the
conversion build log. Check the log for errors that may have showed
up.
If you see errors about not being able to code-sign the target, try
disabling code-signing from the build settings of the target. If you
see other errors, please file a bug report and include the details.
You are strongly encouraged to attach a project that illustrates the
faulty migration if possible.

Xcode 8 beta 4: Build fails with "The following binaries use incompatible versions of Swift:" error

With new Xcode 8 beta 4 we started experiencing the following error during CopySwiftLibs build phase:
Effective srcDirs: {(
<DVTFilePath:0x7f865961e970:'/Volumes/Data/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator'>,
<DVTFilePath:0x7f8657d02b20:'/Volumes/Data/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator'>
)}
error: The following binaries use incompatible versions of Swift:
/Users/user/Projects/git/iphone-swift-1/DerivedData/myApp/Build/Products/Debug-iphonesimulator/myApp.app/myApp
/Users/user/Projects/git/iphone-swift-1/myApp/myAppApi.framework/myAppApi
myAppApi is a subproject in the workspace that contains some shared code (it uses Alamofire).
One thing to note: originally we converted project from Swift 2.2 to Swift 2.3, and then manually upgraded to 3.0.
Does anyone have any idea what might be causing this error?
Thanks!
I had the same problem, but managed to fix it by:
Clean the project.
Close project and quit Xcode.
Clean derived data.
Open the project again and it's there, all nice and working.
I did this on Xcode 8 using Swift 3.
You can also get this problem, if you have the scenario of your container app's code is Swift 2.3 and you're creating a new extension in Xcode 8.
To solve the above scenario...
Note: All code has to be in the same swift (compatible) version to compile without failure.
That being said, one way you could solve this problem is by sticking to Swift 2.3 and then setting your Extension Target's Use Legacy Swift Language Version to "Yes".
You can find that option while Xcode 8 is open as follows:
Select your app project root in the Project Navigator (on the left-hand side)
On the right-hand side, select your extension under the TARGETS
section
Once the extension is selected, click on the Build Settings tab
Scroll down and find Use Legacy Swift Language Version and set it
to Yes from its drop-down menu.
You can now build the project
Note: You might need to fix the overridden code in the extension templates since they were originally in Swift 3.
Before doing anything...
(If you can use Xcode 8.0-compatible with your project)
By default your project is set to Xcode 3.2-compatible
Select your app project in the Navigator (on the left-hand side)
Select Project Document in the Utilities Panel (on the
right-hand side)
Change Project Format to Xcode 8.0-compatible
Try to build your project.
If it doesn't work, try the other solutions proposed.
Note:You can even switch back to Xcode 3.2-compatible after fixing the error and it should work, but you "might" have other build problems later.
Recommendation:
Before debugging an existing project. Close your project and zip a copy of your project file if you did not create a Git repository when you created your project.
I just had the same problem after updating Xcode to 9.3. I fixed the problem simply by just cleaning the build folder. You can do this with Command-Option-Shift-K or in the option menu "Product" -> "Clean" (see screenshot)
I fixed this by deleting the embedded binaries in the project. To do this:
Open your workspace/ project in Xcode.
Navigate to the actual project file (with the General, Capabilities, etc. ribbon).
Go to General > Embedded Binaries, remove by selecting on the ones you don't want and then clicking the minus sign.
Note 1: You shouldn't have to delete them from the "Linked Frameworks and Libraries" section (they should automatically be removed when you remove them from the "Embedded Binaries").
Note 2: I have a lot of dependencies and am using CocoaPods. I have nothing in the "Embedded Binaries" and only the "Pods_[YourApplicationName].framework" in the "Linked Frameworks and Libraries" section.
I had various libraries integrated via carthage. However during the process I switched some of them to cocoapods and forgot to remove the old .frameworks file from the project target.
Removing them solved the build error.
I had the same problem.
My solution was to rename the 'myApp'-directory to 'myAppmyApp' and then I ran the app again. A new 'myApp'-directory was made a the app did run very well again on my iPhone.
A difference with your situation might be this: the name of my app, let's say 'myApp' in the directory 'DerivedData' was myApp concatenated with: '-'
Maybe this will help you.
You need to switch all the dependencies to swift 3.
In your case, Alamofire need to be switched to Swift 3 branch
I had the same error message after adding a Swift 3 version of a framework.
My target framework search path was still configured to find both swift 2 and swift 3 version of the same framework, so my project got stuck on swift 2.3 version.
For me, the solution has been to remove the old framework from my project directory and delete its folder reference from the framework search path.
So I just post the solution I found so far after an hour debugging.
Since Xcode 9, this can be tracked by the compiler log.
If you scroll down to the bottom of the compiler log, you will find this issue is caused by type checking crash.
Just had this pop up after upgrading to Xcode 10.2 ... one of my pods uses Swift.
Fix was to:
pod repo update
rm -rf Pods
pod install

Redefinition of 'xyz' Cocoapods

I have recently upgraded cocoapods to 0.39.0 and xcode to 7.1.
Even after updating pods for several times, I'm constantly getting this error as shown on snapshot.
I found a same question raised here.
The accepted answer is to use 'cocoapods' which I'm already using and the other answer is to downgrade the cocoapods version to 0.38.2. Again followed this link to downgrade cocoapods. But even after that I'm still getting the same error.
I have also tried to remove all pod files and update fresh, it didn't work out either.
Any help is much appreciated! Thanks.
Deleting Derived Data directory worked for me. Open Preferences of XCode and goto last tab Locations. Click on the marked tiny arrow:
Then I deleted this entire Derived Data directory. Re-running the app showed no issue.

Cannot load underlying module for 'Charts'

I'm just getting started with the iOS charts library :
I followed all the steps described under 'Usage' on the main page (https://github.com/danielgindi/ios-charts):
I added a UIView and made it subclass LineChartView
--> in ViewController.swift: the line import Charts gives an error: Cannot load underlying module for 'Charts'
Why is that ?
Thank you !
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.
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!
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.
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.
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 :
Uninstall the pod and install it again
Delete the derived data content
Quit Xcode and start again
Make sure your scheme is targeting an iOS device or simulator. If you build for your Mac it'll give you this error.
Build the project and this error will go away

Resources