I'm trying to install the Charts package to use with CocoaPods and it keeps saying "No such module 'Charts'".
If I added the pod 'Charts' in the podfile, and did a pod install and the files are there in Xcode, how come it still gives me an error when I try to import Charts?
Do I still need to do the steps below? Or does CocoaPods do it for me?
Drag the Charts.xcodeproj to your project
Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework
My pods file looks like this now:
You just have to hit Command-b to build, then the error will go away. The other solution is to hit Product > Build.
I had a similar problem when I was developing an app for an older platform. The CocoaPod I sourced supported Swift 4 but I was developing for Swift 3. When I sourced the last Swift 3 version of the pod, the "No such module" error was no longer there. Try the following line in your Podfile:
pod 'Charts', '3.0.3'
instead of the latest version.
try installing it manually moving the complete charts folder to your project, or downloading using carthage, it's way more cleaner using carthage than cocoapods because it doesn't create you a .xcworkspace like cocoapods.
my Swift App need to support iOS9, but now I'm using a module that needs 10.0 support.. I can't deploy/build the App anymore.
Module file's minimum deployment target is ios10.0 v10.0
Because I defined 9.0 as the deployment target.
It's because of a use ModuleName on top of a Swift file.
How can I catch this? I already made the code that the Module is only available on iOS 10 and up:
#available(iOS 10, *)
But still get the error because of the use on top of the Swift-file.
You don't mention how you are importing the module that you are using, so I'm going to discuss a couple of ways.
I assume that you are not including the source code in your project,
otherwise you wouldn't have a problem.
I also assume you mean import where you say use.
If there is a reason for requiring 10.0, then you will have to edit the code to annotate the 10.0 methods using #available(iOS 10, *) and provide fallbacks
If you have a separate target in your project that is building a framework, just go into that target and in General > Deployment Info and set the deployment target to 9.0.
If you are using Cocoapods or some other dependency manager, you can still do the above, but it will get wiped out on regeneration. If you are using cocoapods you can use a post install hook in your podfile to accomplish the above:
post_install do |installer|
installer.pods_project.targets.each do |target|
if ['RevealingTableViewCell'].include? target.name
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
Note again that this will not help you if there's a good reason the module has a minimum deployment target.
I don't know about other package managers but hopefully this will get you on the right track. Also, note that iOS 9 usage numbers are falling and dropping support for it may be an option as well.
Update: I solved the question. Please see my answer below (underneath the question and comments).
This question was marked as a duplicate, but it's different because it is a brand new error that I couldn't find through any searches.
I tried installing Alamofire into my XCode project.
As per their their tutorial, I installed cocoapods onto my system.
I then navigated to the folder of my existing xcode project in the terminal, and did:
pod init
I then edited the new pod file and added:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'RainyShinyCloudy' do
pod 'Alamofire', '~> 4.4'
end
Finally, I executed the command:
pod install
My terminal told me the install was successful.
But when I opened the .xcworkspace, made a new swift class and tried to import Alamofire, I got this error:
One possible reason could be that I had tried to install an earlier version of alamofire earlier, deleted it and then installed this.
But I really don't know how that could have mattered.
Thanks for any help you guys can give me.
Actually it failed because you were trying to import AlamoFire and not Alamofire. Imports are case sensitive.
Update: I posted an answer earlier that was wrong.
But now I actually figured it out.
I made a new project, went to the settings menu by clicking on the name of my app in the project explorer.
Then I went to Linked frameworks and libraries which is at the very bottom of the General tab.
I pressed that little + icon, selected Alamofire.framework. and set the status to required
Following this, cleaning and rebuilding the project made the error go away.
I have an Objective-C project in Xcode 8 Beta 3. Since updating, whenever I try to build I receive the following error:
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
Has anyone encountered this? Since it's an Objective-C project there's no build setting to configure Swift. I have also made sure none of the project dependencies or CocoaPods are using Swift. The only solution I have is to use Beta 2. Any ideas how I might fix this issue?
I should also mention I'm running OSX 10.12 Beta 2.
If you are using CocoaPods and want it to be fixed automatically every time you are doing a pod install, then you can add these lines to the end of your Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
EDIT: This problem is now fixed if you use CocoaPods v1.1.1 or later.
Don't forget to remove the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES setting from your main project targets.
I just found a way to fix it.
Go to the Build settings of the project or library and set the Swift Compiler Version attribute "Use Legacy Swift Language Version" from Unspecified to Yes or NO.
I have been ignoring this problem for a while now and just working on other stuff in the meantime - I finally found the solution to my problem.
Since my project is Objective-C I figured maybe one of the Pods I am using was using Swift, I checked each Pod and none of them were.
The final solution was that my Core Data model was set to generate code in Swift even though I have been manually generating them in the File > New > NSManagedObjectSubclass menu. All I had to do was switch it to Objective-C.
This issue is also visible in Xcode-8.1 . When we add new Target like Extension or Widget and Third party library is integrated in new target with the help of cocopods. After Pod install . We can face same error as above .
Change the Use Legacy Swift Language Version in every Library Build Setting to
No.
If you are using Xcode 8 or later
Go to Build Settings
Find use legacy swift language version
Yes - Swift 2.3
No - Swift 3.0
Add below code in end of the podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
I'm working on a project which has mixed objective-c and swift code
I previously used swift version 2.3 and after upgrading to swift 3 I was unable to build the project. Xcode complained with the mentioned error message.
Apparently, there was still some outdated Swift version specified in my project.pbxproj file. There was swift 3.0.1 specified:
SWIFT_VERSION = 3.0.1;
Whereas, I already had 3.0.2 installed:
$ xcrun swift -version
Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9
Sooo, I fixed it by changing the Swift version in the project-pbxproj file to:
SWIFT_VERSION = 3.0;
Seems the patch level version specifier was too specific.
In my case I have Just do the Following things
Choose project Target=>Go to Build setting=>Search for “Swift Language Version” =>give Value the current Swift version
Thats all It has fixed my Issue
I got the same error. I tried for searching "Use Legacy Swift Language Version", but not found. I am using Xcode 8.3.3
After surfing too much and working around i found this solution, and this worked for me.
Here are the steps.
1=> select your target from Xcode
2=> go to build setting
3=> search for "Swift Language Version"
4=> change it to swift 3. (or accordingly.)
set "Use Legacy Swift Language Version" to "YES" if you using a old version of swift in your project or any swift 3rd party. "No" if your project uptodate to current swift version.
if you don't configure your swift version , after every update and Install, Pod framework need to specify this.
I actually had to do a search for "Legacy Swift" to be able to change it from unspecified to "Yes" When I simply scrolled down to the section described above, I was not able to change it. I hope this will help someone.
My project is written in Swift. I got that same error with fastlane. What happened was my Xcode auto-updated so I had to update my project to Swift 3.0. Got a ton of errors. Fixing and debugging was taking too much time and it was not worth it at that moment so I decided to install an older version of Xcode. Reverted my code to 2.3. Then fastlane beta wasn't working anymore. Turns out, I needed to set the Command Line Tool to 7.3.
I was having this same issue and solved it by doing the following:
In Project > Build Settings:
Always Embed Swift Standard Libraries = $(inherited)
Use Legacy Swift Language Version = YES
Then in my Podfile:
config.build_settings['SWIFT_VERSION'] = '3.0'
Using these three settings removed all warnings and allowed me to compile properly.
The most obscure and what actually got progress for compiling was changing the SWIFT_VERSION in the Podfile from 3 to 3.0 as suggested here.
From XCode 8 onwards, you can use swift 2.3 even though XCode 8 uses swift 3.x as default swift version. To use swift 2.3, just turn on flag Use Legacy Swift Language Version to YES from Build Setting, then XCode will use Swift 2.3 for that project target.
Before trying complicated solutions, here is a basic check you need to do if you are new to Cocoapods and you are having this issue.
You might need to:
Open your Podfile again
Check that the line for platform is not commented out with a '#'. It should finally look like something like :
platform :ios, '10.1' # Put the right version and no #platform here
use_frameworks! # For swift
pod "MyPod" # Your mean pod :)
Save your Podfile, Close Xcode, and Run pod install again
Open your project.xcworkspace
Maybe it's just that.
If not, you can go above ;-)
I had this same problem after updating to xcode 8.3.2 but the option "Use Legacy Swift Language" was gone. This seems to be the option to change now:
Used this fix with Alamofire and other libs and all works ok.
Go to Project Build Setting for project and Target do below two.
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
And
Swift Compiler - Version = Swift 3
Change to latest Swift 3.
Error resolved.
If it's resolved your error fix, please like it.
In Xcode 9 beta. Go to Project Settings, Build Settings, search for Swift Language Version. In Xcode 9 you must specify if you are using Swift 3.2 or Swift 4.
If you change ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to NO still not work, it is because the xcode issue, not your problem. Doing the follow steps:
1.Change ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES property to be YES on the warning target
2.then it will show an warning on left bar which recommend you change to swift 3.0
3.then change back to NO. Rebuild the project, the xcode finally detect your change to NO!
Problem solved in this case!
Just need to check the following settings
File -> Workspace setting ->
1 - Check "Don't show a diagnostic issue about build system deprecation"
2 - set Build System to Legacy Build System (Shared Workspace)
3 - set Build System to Legacy Build System (Pre-User Workspace)
So I have a bit of an issue here. I'm using SwiftyJSON which does not appear to work without the use_frameworks option, and I also have need of the UrbanAirship framework as well.
If I disable use_frameworks, I'm able to Import AirshipKit without incident in my AppDelegate. However SwiftyJSON then cacks and I'm not able to use that. The reverse is true however if I enable it.
Has anyone had any luck or found a solution how to have both a dynamic and static library with Cocoapods?
What should my bridging header look like for UrbanAirship -- if I'm even able to use one with use_frameworks enabled?
Thanks so much!
Current Podfile:
platform :ios, '8.0'
use_frameworks!
target 'MyProject' do
pod 'UrbanAirship-iOS-SDK'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end
The documentation for the URbainAirship-iOS-SDK pod is very lacking. In fact it doesn't make any reference to the fact that the module name diverges from the official documentation (even though its in the official repo).
You have to import `UrbanAirship_iOS_SDK' and all should be well.