Error compiling RealmSwift with Xcode 8.2.1 and Swift 3 - ios

I installed RealmSwift using Cocoapods. It installed successfully, but when compiling it shows 96 errors as shown below
I have tried every solution I found on the internet. I have deintegrated the pods and installed again, but I keep getting the same errors. Please help!

It looks like Xcode is trying to run Realm Swift against the wrong version of Swift. A couple of things that I recommend you try:
Make sure to run pod spec update to update your local copy of Realm to the latest version.
Make sure you've followed the Realm CocoaPods instructions and added this to the bottom 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.2'
end
end
end
If that still doesn't fix it for you, please update your question with a copy of your podfile so we can review it. :)

Related

How to update swift 2.3 project to latest swift 4

I am having too many cocoapods installed. It shows too many compile time errors. How to solve this?
I am new to swift so looking for help.
Thanks
Choose auto upgrade after opening the project in Xcode 9.
In Podfile refer to the framework built in swift 4. Add below script in your Podfile and do a pod install, which will set the swift version of all pod targets to 4.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4'
end
end
end
Hope this helps in proceeding in upgrading the application to swift4

Error compiling Swift 3.0.1 Project after Pod Update

I recently migrated my Swift 2.3 SDK Project to Swift 3 using the XCode Swift Migrator. After doing so, I updated my pod dependencies (AlamoFire - 4.4.0 and SwiftyJSON - 3.1.4) to use their respective Swift 3 Versions.
Unfortunately, after this, my project did not build. I am getting the following errors:
Module compiled with Swift 2.3 cannot be imported in Swift 3.0.2:
.../Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule
I've set all the "Use Legacy Swift Language Version" to "NO" but still nothing.
I've "clean & build" project and "closed & reopen" workspace to no avail.
What else could I be possibly missing? How can I fix this?
Thanks.
Delete the pods from the pod file.
Quit Xcode.
Try to uninstall them by using the command pod install. This will update your project and delete all of the existing pods correctly.
Open Xcode and clean your project (and eventually try to build it once) and make sure the pods are gone.
Add the pods again to your pods file and run pod install again.
This is a general fix that could do it. It worked for me several times.
Try adding this in your pod file after all the pods and run pod install again...
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

why are after a new react-native project lots of deprecation warnings?

steps to reproduce:
installed versions:
react 15.4.2
react-native 0.40.0
create a new Project
react-native init reactNativeTest
Running Project
1) Start Xcode
2) Open Project reactNativeTest
3) Run App
when I run it in xcode I get hellot of deprecation warnings, semantic issues and CoreFoundation Errors.
see screenshot
These are known issues in React Native 0.40 (reported in React Native github project as issue #11736) that occur for others (myself as well) on a fresh project.
As of 17 minutes ago, there are a number of pull requests which reduce some of the issues.
One commenter on the issue reports that "Those are warning and you can mostly ignore those warning. You project should run fine with those warning." I've confirmed this, but hopefully we'll get these warnings cleaned up soon.
Why
The OS Deployment target is way too low for many of these dependencies. Some are set to iphone 4!
I created a bug in React Native with this same solution
Solution
Copy function min_OSTarget_post_install into your Podfile
Call the function within post_install
pod install
See hundreds of Xcode warnings dissapear
Code
def min_OSTarget_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if Gem::Version.new('8.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
post_install do |installer|
...
min_OSTarget_post_install(installer) // ADD THIS LINE
end

XCode 8: Can't find AFNetworking header files and Swift pods errors

Today I've upgraded my XCode to 8 version, but After this I got a lot of errors. Ex:
The targets “Charts” and “CircleProgressView” contain source code developed with an earlier version of Swift.
Choose “Convert” to update the source code in these targets to the
latest SDKs. You will be given the choice to use Swift 2.3 syntax or
update to Swift 3.
This action can be performed later using “Convert to Current Swift
Syntax” in the Edit menu.
And AFNetworking/AFNetworking.h file not found. The steps I made:
Added post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end to my Podfile
Updated my cocoapods gem to a latest version.
After the 1st step my error about swift module has left. But I still can't find header of my AFNetworking. Help me out please

Converting from Swift 2.3 to 3.0

I'm trying to migrate my Swift project from Swift 2.3 to Swift 3.0. I'm using the Realm framework for data storage, and it's giving me a headache!
I have tried several times now, and i have manually migrated from Swift 2.2 to Swift 2.3.
But after i used the build in migration assistent, i'm getting the following error.
I can't see which binaries causing the issue this time, but earlier it came up with Realm and RealmSwift framework. I have upgraded the Realm pods to version 1.1.
I have tried Clean Build my folder several times, and i have deleted everthing inside DerivedData, but the same issue still persist.
Any suggestions?
In your Podfile, add use_frameworks! and pod 'RealmSwift' to your main and test targets. Paste the following at the bottom of your Podfile updating the Swift version to 3.0:
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
Source: https://realm.io/docs/swift/latest/#installation
Credit for this goes to jpsim.

Resources