FBSDK swift 3 with 53 errors - ios

I'm trying to download Facebook's sdk on Cocoapods following the instructions in the README
https://github.com/facebook/facebook-sdk-swift
I downloaded Cocoapods, inserted
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
into my Podfile, executed pod install and opened my xcworkspace. But when I run my app I get 53 error messages like
"Function types cannot have argument label 'bytesSent'; use'_' instead"
I could try manually fixing these errors but is this supposed to happen?
I'm using Swift 3

Try clean and re-build the project or refactor it to the newest Swift syntax again. This seems to be a bug in the newest Xcode release (I exprerienced it in the previous version though).

Related

How to fix build error with FBSDKLoginKit in Xcode

My ios app was working fine until I ran "pod install" and updated all of my pods. I'm now getting an error when trying to build in Xcode.
FBSDKLoginKit/FBSDKLoginManagerLoginResult.m:43:25: No known class method for selector 'dictionary:setObject:forKey:'
Here are the FB pod versions used:
Installing FBSDKCoreKit (5.0.0)
Installing FBSDKLoginKit (4.44.1)
Those are not specified in my podfile. I think they're installed as part of FirebaseAuth which is in my podfile.
How can I resolve this?
Add pod 'FBSDKCoreKit', '~> 4.44' to the Podfile.
There's a bug in the 4.x versions of FBSDKLoginKit. Its podspec allow major version updates to its FBSDKCoreKit dependency, but the code doesn't comply.
There's no FBSDKCoreKit version specified in the 4.44.1 version like there is in the 5.0.0 version.
The suggested Podfile change is a workaround for the podspec problem.
The current version of FirebaseUI requires version 4.x of FBSDKLoginKit.
In my case, I had to also fix the version of Firebase/Core, like following.
pod 'FBSDKCoreKit', '~> 4.35'
pod 'FBSDKLoginKit', '~> 4.35'
pod 'Firebase/Core', '~> 5.20'
Additionally information
The above case is that you have FirebaseUI/Twitter for Twitter login, which is using TwitterKit internally. But TwitterKit is finished to support. So if you have already used FirebaseUI/Twitter, the following should be used
pod 'FirebaseUI/OAuth'
instead of the below.
pod 'FirebaseUI/Twitter'
At the result, we can use the latest & stable FBSDKCoreKit, FBSDKLoginKit and Firebase/Core.
I have similar issue. It is after installing FBSDKCoreKit 5.0.0 (was 4.44.1) as part of the Firebase codebase.
It seems that there may be some code that Firebase use:
(void)addLoggingExtra:(id)object forKey:(id)key
{
[FBSDKInternalUtility dictionary:_mutableLoggingExtras setObject:object forKey:key];
}
That seem to be problematic and gives the error:
No known class method for selector 'dictionary:setObject:forKey:'
While I don't know how to solve it, the above may provide insights to others.
the above answer marked as correct didn't work for me.
this is how I fixed this error. First I downloaded iOS sdk from facebook : https://developers.facebook.com/docs/facebook-login/ios?sdk=fbsdk
then I opened downloaded sdk and copied FBSDKCorekit.framework, FBSDKLoginKit.framework, and Bolts.framework into 'Frameworks' folder in my Xcode project.
(I'm not using facebook to login at this time but I was still getting the same error as you guys are)
At last I changed my pod to:
pod 'Firebase/Core'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Phone'
pod 'FirebaseUI/Google'
pod 'FirebaseUI/Email'
update pod, clean project and rebuild
a couple errors pop up for deprecated code in the fb sdk. click 'fix' from the error and project runs as expected.
Very first you need to proper check version of pod which you are installing. Because it looks that you are installing earlier version of Facebook Pod. Please look at screenshot I have attached. It's work fine for me.
Though you can follow these steps to overcome this error.
Comment All Facebook pods in pod file.
Now close Xcode project, clear all recent items, Quit Xcode. Clean derived data.
Go to Terminal, jump to your project path directory, run command pod install (It will remove all Facebook pods).
Please save or commit your code if you are using versioning system.
Now open your Xcode project and go to pod file.
Copy latest pods from here and paste into pod file.
Now again close Xcode project, clear all recent items, Quit Xcode. (Please don't build or run project)
Go to Terminal and run command pod install (It will install all latest Facebook pods).
Don't forget to save or commit code.
Then open Xcode project, clean folder, build and then run.

Xcode 10 build fails with 'Command CompileSwift failed with a nonzero exit code

I updated Xcode to version 10 recently and started to receive a strange error when trying to build my project. I'm currently on Swift 4.0 and I did try to upgrade to swift Version 4.2. But when I did I received this same error in many of my frameworks.
Command Compile Swift failed with a nonzero exit code
So far I've deleted the derived folder. Updated all pods, also deleted all pods and reinstalled them using the terminal commands below.
sudo gem install cocoapods-deintegrate cocoapods-clean
pod deintegrate
pod clean
pod install
This didn't work to fix my issue. However, I found something that could work which was adding arm64 architecture in Build Setting -> valid architectures and enabling automatic code But, when I checked it was already there and code signing was enabled already.
Additionally, I do have a few other build errors that have to do with frameworks.
SwiftMessages
Value of type 'SwiftMessages.Config' has no member 'presentationContext'
WhatsNewKit
Missing argument for parameter 'backgroundColor' in call`
I opened issues with the developers of each of these frameworks to seek help with these issues.
Issue On SwiftMessage GitHub
Issue On WhatsNewKit GitHub
When I click presentationContext it brings me to the struct within the SwiftMessages Framework. Usually, when I've had the "has no member" warning I cannot click to see the original place where it exists.
I assume this has something to do with cocoa pods, but haven't been able to find a solution yet. What can I do to correct this issue? If anyone could help would be deeply appreciated been stuck on this for a day now.
Update:
The two frameworks latest builds were for swift 4.2. When I changed the version of each framework to one that was built in swift 4.0 I got the project to build.
Make sure that, your project Swift Language Version is in the proper version. SwiftMessages 6.0.0 works with Swift 4.2.
I solved this way:
Comment all pods in your .pod file
From your terminal, run the command pod install --no-repo-update
Open Xcode perform a clean and rebuild the project
Now open your .pod file and uncomment the first library
From your terminal, run the command pod install
Repeat steps 2 - 3 - 4 -5 for each uncomment library in your .pod file
I hope it can be of your help.
Make sure that, Your project build settings Optimization Level is in No Optimization[-Onone].
for pod SwiftMessages if your app is not swift 4.2 you need to user the version 5.01
pod 'SwiftMessages', '~> 5.0.1'
and it will work like a charm
Set Swift version to 4.2 then pod deintegrate, pod install, fix this problem for me. Thanks #alejandro-iván
Good Morning!
Do a clean. using"commond + shift + k
Close Xcode.
Navigate to project directory where the Podfile exist.
Do pod update/pod install
Open x.xcworkspace
This error happened to me when I used same class name in two different groups. Then I renamed one of the classes and the problem was solved
All of the answers were helpful to me. In my case, I only install frameworks manually but this kind of problem also happens. I tried all of the answers and was still getting this issue during the build. Curiously, while coding, I could cmd-click and resolve all of the "missing" components. I also cleaned and deleted derived data, restarted Xcode, etc.
I eventually got it working by inducing these additional steps:
On each of the framework project/targets (including my own):
Verify consistent Swift version (4.2 in my case)
Set Build for Active Architecture Only to No
Set Valid Architecture to arm64, armv7 (to match with base project)
Set Optimization Level to None (for Debug)
Set Compilation Mode to Whole
I had several frameworks (homegrown) plus my app. Somehow they ended up being out of sync as far as the Swift version. Make sure that all frameworks are the same version. In my case, they all needed to be set to Swift 4.2. If you haven't done the migration to 4.2 then remember that Xcode helps with this: Edit -> Convert -> To Current Swift Syntax.
only for re-install pod using that command pod install
see below attachment
In my case I connect an actual iphone not simulator and run the app once on it, It solved the problem. But connect iphone firstly, then choose it from this menu, then press run button.
The problem will solve too.
I stumbled upon this problem when upgrading to Xcode 10.2 and Swift 5. After trying everything I found this in the release notes:
The Swift compiler may crash during a build when the Thread Sanitizer
is enabled. (48719789)
And sure enough, efter turning off Thread Sanitizer my project could be compiled without errors again.
So if you get this error and have Thread Sanitizer enabled - turn it off!
Same issue happened to me in Xcode 10.2, it was a Xcode bug..!
So, I opened in older Xcode version(9.4), and it worked fine. Then I updated to the Xcode 10.2.1 after it's release -> Clean and build your project, now my problem solved.
I'm having the same problem, my Xcode version is 10.2.1 (10E1001),
Cocoapods version is 1.7.0.beta.2.
I returned to Cocoapods 1.6.1 and the problem was solved.
The specific steps are:
pod deintegrate to cancel the integration.
Uninstall all Cocoapods.
for i in $( gem list --local --no-version | grep cocoapods );
do
gem uninstall $i;
done
Install the stable version of Cocoapods. For now it's 1.6.1.
gem install cocoapods
Clean Project and empty DerivedData⁩
pod install
Recompile the project
In my case it was a code error:
self.myDto.map{ (dto)} in
var stringValue = (dto.value(forKey: "name") as! String)
stringValue.append("c")
return stringValue
}
Just removed that stringValue variable fixed the problem.
I just had the same error message and none of the answers here and in the duplicates of this question were applicable to my project or helpful.
I kept on reading through the error messages and came to a realisation that I had stupidly named two seperate swift files in different folders with the same name intending to change one, but before I got to change one, I tried to run my project and have been annoyed for the last hour.
Bottom line, don't accidentally name your files the same name and read your error codes thoroughly!
target 'XYZ' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for xyz
pod 'SwiftyJSON'
pod 'Localize-Swift'
pod 'Alamofire'
pod 'Kingfisher'
pod 'Tabman'
pod 'RSSelectionMenu'
pod 'Pushbots'
pod 'ACProgressHUD-Swift', '~> 1.4'
pod 'SKPhotoBrowser'
pod 'ZoomableImageSlider'
pod 'RSSelectionMenu'
pod 'DropDown'
pod 'ImagePicker'
end
I updated platform :ios, '10.0' to 11.0 and the error disappeared. Change your platform or OS version and check. Hope that could help.
Specify your pod's version for example pod 'RealmSwift', '~> 5.3.5'
or uncomment # platform :ios, '9.0' in your Podfile
I faced this issue on Xcode 14. Add this on podfile bottom.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# some older pods don't support some architectures, anything over iOS 11 resolves that
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end

Error in Cocoa pod file 'XLPagerTabStrip' in Xcode 10

My Xcode version is 10.0 and Swift 4.2.
When I update my pod file, I am seeing the error as shown in the screenshot.
I think 'XLPagerTabStrip' pod file is not getting updated to latest release. To verify this, I created a sample project and installed 'XLPagerTabStrip' pod file only. There also I can see the same error.
try following pod command ==>
pod deintegrate
and after this try following command ==>
pod install
it will take a while but definitely solve the problem.

Objective C Project in Xcode 7 CocoaPods Error

The Terminal Error I am receiving after running pod install is:
I realize that ReactiveCocoa's cocoapod is entirely in SWIFT and that I need to Bridge the header files, but my attempts have been far from successful.
I did find this response from one of TeamTreehouse's Staff:
"The SimpleAuth library has it's own set of dependencies one of which is ReactiveCocoa. ReactiveCocoa was recently rewritten completely in Swift so that's the Swift code that's getting added to your project. Unfortunately there are 2 versions of ReactiveCocoa out there, written in Swift 1.2 and Swift 2.0.
SimpleAuth is currently automatically pulling the 1.2 version of ReactiveCocoa.
Swift 1.2 can only be run in Xcode 6.1 and not in Xcode 7 (which requires Swift 2).
So if you are using Xcode 7, then you're pulling in the Swift 1.2 version by default and this is causing all the Swift errors.
Also, you have to do some cleanup work to get Swift frameworks to run in a mixed Objective-C/Swift project which includes adding a bridging header and stuff."
.
^^ Explains my Problem ^^
Thanks in advance!
Edit
After adding use_frameworks! to my Podfile, I was receiving errors like:
The error message says to add the line use_frameworks! to your file called Podfile.
Add it below the first line that should probably say platform :ios, 'x.0'.
You need to use ReactiveCocoa 4.0, which is target Swift 2.0, yet still under alpha version.
If you want to have a try, check this out.
use_frameworks!
target 'YOUR_TARGET' do
pod 'ReactiveCocoa', '~> 4.0.0-alpha'
end
After attempting use_frameworks! within my pod file, I was still experiencing errors due to ReactiveCocoa and the .swift files (even after auto-correcting the errors that Xcode attempted to fix for me).
Within my Podfile I was able to resolve both sets of errors I was experiencing:
1. When including use_frameworks! in the Podfile
2. Also when running my original pod install in hopes of adding the Parse cocoapod
Final code in Podfile
pod 'ReactiveCocoa', '2.4.7'
pod 'SimpleAuth/Instagram', '0.3.6'
pod 'SSKeychain'
pod 'Parse'
You can actually request the latest version of the dependencies. Your Podfile should look like this:
platform :ios, "9.0"
use_frameworks!
target 'MyAppNameHere' do
end
pod 'Box', :head
pod 'Result', :head
pod 'SimpleAuth/Instagram'
Then peform a pod update and in your project, Product > Clean and Product > Build and will work again.

Trouble using AWSiOSSDKv2 via cocoapods 0.36 beta2

Using a Podfile like so:
platform :ios, '8.1'
source 'https://github.com/CocoaPods/Specs.git'
pod 'AWSiOSSDKv2'
I am getting a bunch of "file not found" errors in my xcode project related to the #imports being used in the AWSSDK. E.g. in AWSMobileAnalyticsContext.h:
#import "configuration/AWSMobileAnalyticsConfiguring.h"
I suspect this has to do with the fact that the project hasn't been updated with a dynamic framework output in mind (which is what the beta of cocoapods is using). I've gone through and actually tried hand-updating the paths to these imports, and I can clear most of the file not found errors, but then it starts complaining about the Mantle.h import elsewhere.
Anybody successfully gotten the AWSiOSSDKv2 to work with an app by using the cocoapods beta (or even a forked version that uses dynamic frameworks)?
I was able to get it to work today.
I deleted all traces of cocoapods since it had originally been installed using 0.35.
[project].xcworkspace
All mentions in [project].xcodeproj related to pods (yes, by hand with vim)
Pods/
Podfile and Podfile.lock
I then installed my swift pods using carthage instead. For me, this was Alamofire and SwiftyJSON.
I made a commit here, so I could easily go back to this point.
My podfile was just this, I could not get it to work with the use_frameworks! line.
target 'WhatsLegal' do
pod 'AWSiOSSDKv2'
pod 'Facebook-iOS-SDK'
end
I ran pod init and then pod install, and it started working from here!

Resources