Closed sylver closed 9 years ago
Having the same error while trying to add SDK 4 into swift project with use_frameworks! Pods/Facebook-iOS-SDK/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h
I have also been pounding my head against the wall with this problem. I'm starting a new project, and I'd prefer to begin prototyping with the new SDK, rather than the old one.
Hey, I've been looking into it and it seems cocoapods does not support mixed frameworks and libraries: https://github.com/CocoaPods/guides.cocoapods.org/issues/53. The Facebook SDK is a static library and does not need the use_frameworks! flag. Are you somehow able to use other static libraries with swift frameworks in your project?
Hello @chrisp-fb, sure we can use the traditional method of linking your downloadable frameworks, i did that since i have no other choices right now to use your last SDK, which is better than the previous one. But i'm feeling like going years backward doing that and that's really unexpected from Facebook for its new major SDK version to not be compatible with cocoapods.
I think you should update your documentation to state explicitly you're not supporting cocoapods anymore with your 4.x version. Your previous SDK was compatible with use_frameworks!
flag, and now swift is here we can't do without it.
We do want to support Cocoapods and I didn't have issues using 4.0 without the use_frameworks!
flag. I'll take a closer look at what Cocoapods is doing with that flag to see if we can work around it or if I'm misunderstanding their documentation.
Hey again Chris,
Yes, i agree that 4.0 is working without the use_frameworks!
flag, but for current projects using swift libraries, this flag is now basically mandatory to be able to use all major pods, and cocoapod isn't providing a per pod switch about this flag.
I hope you would be able to find a quick workaround to use it in cocoapod again, i've tried but found nothing so far.
Waiting for this as well. Starting off a project with swift + SDK4 + cocoapods.
I just pushed some new podspecs to our :dev
branch, if you have time to try them out, that'd be great. it did find a bug in one of our import statements which means you'll initially get an error when compiling but you can manually fix it in your copy* (or if you know some podfile syntax that would use the dev branch code, let me know).
If it all looks good I'll make these official for our next 4.1 release.
pod 'FBSDKCoreKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKCoreKit.podspec', :branch => 'dev' pod 'FBSDKShareKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKShareKit.podspec', :branch => 'dev' pod 'FBSDKLoginKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKLoginKit.podspec', :branch => 'dev'
Hey @chrisp-fb, Awesome ! Works perfectly.
btw, i tried the header_mappings_dir
myself to fix this, but it didn't work in subspec, i didn't thought about split it up in different podspecs, congratz.
Great, I'll leave this issue open until we ship 4.1 and publish the new podspecs properly.
Hi @chrisp-fb : any idea when you will ship 4.1
? I'm building a Swift pod that has the Facebook SDK 4.0 as a dependency, so it'd be great if this could work!
In the meantime @sylv3r, do you have any idea how I would link the SDK as a framework (not a pod dependency) in my own module? Is this even possible? Cheers!
Or is @chrisp-fb is there a way to way to reference your dev
branch and splitted podspecs (see above) in my module's podspec (not in a Podfile)?
Cheers!
Hi @julien-c - as far as I know, that's not possible : http://stackoverflow.com/questions/22447062/how-do-i-create-a-cocoapods-podspec-that-has-a-dependency-that-exists-outside-of
That said, I did push the FBSDKCoreKit and FBSDKShareKit podspecs to the public pod trunk so those are available already. And just now I added a custom tag for the fix in the :dev branch and pushed a FBSDKLoginKit podspec to the public pod trunk so that should be available as soon as Cocoapods updates their trunk.
@chrisp-fb I'm trying to use the new pod spec references you mentioned above in https://github.com/facebook/facebook-ios-sdk/issues/725#issuecomment-92432483 in a Swift 1.2 / Xcode 6.3 project, and am getting this error:
.../Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/Internal/_FBSDKLoginRecoveryAttempter.h:19:9: 'FBSDKCoreKit+Internal.h' file not found with <angled> include; use "quotes" instead
I changed that file to use the quotes that were recommended, and it now compiles.
I have amended Podfile
and edited _FBSDKLoginRecoveryAttempter.h
as suggested by @chrisp-fb in comment. I have also removed pod 'Facebook-iOS-SDK'
.
Now, I'm getting these errors:
Use of private header from outside its module: '<filename>.h'
I'm using cocoapods-core-0.37.0.beta.1.gem
I am getting the same or similar error as @evgeniyd.
Here is my Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 1.2'
pod "SwiftyJSON", ">= 2.2"
# Facebook SDK 4.0.1 is not yet compatible with use_frameworks! (see https://github.com/facebook/facebook-ios-sdk/issues/725 )
# pod 'Facebook-iOS-SDK'
pod 'FBSDKCoreKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKCoreKit.podspec', :branch => 'dev'
pod 'FBSDKShareKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKShareKit.podspec', :branch => 'dev'
pod 'FBSDKLoginKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKLoginKit.podspec', :branch => 'dev'
Here is the error I am getting (cocoa pods 0.37.0.beta.1)
.../Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppEvents.m:20:9: Use of private header from outside its module: 'FBSDKAppEvents+Internal.h'
Adding 'pod Facebook-iOS-SDK' together with the other pods does not work either.
.../Pods/Headers/Private/FBSDKCoreKit/FBSDKAccessToken.h:59:1: Duplicate interface definition for class 'FBSDKAccessToken'
I also get all these warnings:
Check dependencies
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKAccessToken.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKAppEvents.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKAppLinkResolver.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKAppLinkUtility.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKApplicationDelegate.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKButton.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKConstants.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKCopying.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKCoreKit.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKGraphErrorRecoveryProcessor.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKGraphRequest.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKGraphRequestConnection.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKGraphRequestDataAttachment.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKMacros.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKMutableCopying.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKProfile.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKProfilePictureView.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKSettings.h
Warning: Multiple build commands for output file /Users/enekoalonso/Library/Developer/Xcode/DerivedData/XXXX-gmljnhauajyqjdfqyrbobqzmzlsx/Build/Products/Release-iphonesimulator/Pods-XXXX/Facebook_iOS_SDK.framework/Headers/FBSDKUtility.h
it looks like the next pod version changes some behavior regarding private headers in the modules, can you use 0.36.3 in the meantime.
Also, I used the wrong syntax to specify the dev branch, use the :git
param instead (to avoid having to edit the import statement manually):
pod 'FBSDKCoreKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev'
Installing the pod as mentioned (with :git
) seems to solve the issue with the header files, but I cannot figure out how to import the SDK. import FacebookSDK
does not work:
.../AppDelegate.swift:14:8: No such module 'FacebookSDK'
I tried importing the pod as a framework (import FBSDKCoreKit
) which works, but then Xcode cannot find FBAppEvents.activateApp()
:
.../AppDelegate.swift:27:9: Use of unresolved identifier 'FBAppEvents'
I've tried one more thing, installing the pod from the dev branch as follows:
pod 'Facebook-iOS-SDK', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev'
Then, on my AppDelegate, I imported the SDK as import Facebook_iOS_SDK
since that is the name of the framework generated by cocoa pods.
Everything was looking good, but the build failed again with the header files (cocoa pods 0.36.4):
.../Pods/Facebook-iOS-SDK/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h:23:9: 'AppEvents/FBSDKAppEvents+Internal.h' file not found
Using cocoapods-0.36.4
it works. I still had to edit '_FBSDKLoginRecoveryAttempter.h', but it had been suggested automatically by Xcode that time.
#pod 'Facebook-iOS-SDK'
pod 'FBSDKCoreKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev'
pod 'FBSDKShareKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKShareKit.podspec', :branch => 'dev'
pod 'FBSDKLoginKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKLoginKit.podspec', :branch => 'dev'
You also have to import FB umbrella headers into YourProject-Bridging-Header.h
in order to use SDK from Swift classes.
// Facebook SDK
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
I get the same issue with the latest Facebook iOS SDK but a different error message.
'AppEvents/FBSDKAppEvents+Internal.h' file not found
I have CocoaPods version 0.36.4 installed.
The new podspecs in the dev branch work fine with 0.36.4; note the :git
param should be applied for all the kits, so the podfile should read
pod 'FBSDKCoreKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev' pod 'FBSDKShareKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev' pod 'FBSDKLoginKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev'
Do not use the Facebook-iOS-SDK podspec. We'll deprecate it officially in the next release coming soon. If you're using Swift, bridging headers should not be necessary either as each kit defines a module, so you can simply import FBSDKCoreKit
in your .swift files.
It seems that Bolts.framework module map issue that has been fixed in f92b5200c5aaadd0be12a4432ee068f7b2558892 does not allow us to get rid of importing FB umbrella headers into YourProject-Bridging-Header.h
.
Both, master and dev FB SDK branches are using Bolts 60c0d2b03596a191bddfdf87bd61e38a4790d94d
@eneko - I just pushed another update to the kit podspecs in the :dev
branch to remove our private_header declaration so it should work with pods 0.37 now; let me know if you see further issues.
@evgeniyd - right, the Bolts module map issue is still present if you're not using Pods, but will be resolved in the next 4.1 release.
@chrisp-fb Thanks for the quick response, Chris. I added those to my Podfile
and installed them. And I'm facing a new issue.
I have a UIView
to show the Facebook login button. I've set its class as FBLoginView
and created the following IBOutlet
to my view controller.
@IBOutlet weak private var facebookLoginButton: FBLoginView!
I get the following two errors at this line.
Use of undeclared type 'FBLoginView'
'weak' cannot be applied to non-class type '<
I imported all three frameworks.
import FBSDKShareKit
import FBSDKCoreKit
import FBSDKLoginKit
But it doesn't change anything.
@Isuru-Nanayakkara - FBLoginView is not available in v4 of the SDK, use FBSDKLoginButton instead (all types are now prefixed with FBSDK). Let's keep this thread focused on pods issues; feel free to open new thread for other issues
Hi @chrisp-fb, thanks for your patience!
I just realized I was targeting FBAppEvents.activateApp()
while the new SDK has FBSDKAppEvents.activateApp()
. My bad.
Eneko
@chrisp-fb Still not working for me in a podspec
(works in a Podfile though):
Pod::Spec.new do |s|
s.dependency 'FBSDKCoreKit', '~> 4.0'
s.dependency 'FBSDKLoginKit', '~> 4.0'
end
I get the following error when trying to pod spec lint
:
-> FBSDKCoreKit (4.0.1)
- ERROR | [iOS] [FBSDKCoreKit/arc] Returned an unsuccessful exit code. You can use `--verbose` for more information.
- NOTE | [FBSDKCoreKit/arc] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[!] Unable to load a specification for the plugin `/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-release-fix-0.1.2`
-> FBSDKLoginKit (4.0.1)
- ERROR | [iOS] Returned an unsuccessful exit code. You can use `--verbose` for more information.
- ERROR | [iOS] FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/Internal/_FBSDKLoginRecoveryAttempter.h:19:9: error: 'FBSDKCoreKit+Internal.h' file not found with <angled> include; use "quotes" instead
Your help is appreciated as this is kind of a showstopper for me! :)
hey @julien-c , the corekit error is because the fbsdks are intended as static libraries so you should pass the --use-libraries flag (though I don't know for sure if that works transitively). the loginkit error is because of a code bug that is only not yet pushed to master and unfortunately you cannot specify a branch when describing a dependency in a podspec; however, for your local development you can still try adding the :path
override in a consuming podfile (ie., your pod and the fbsdk*kits should all have the :path
override).
@chrisp-fb after removing all pods and installing them back again, clearing out caches and so, I can confirm dev:
works with import
When is the 4.1 release a lot of developers would atleast like to know a date. We are sitting still due to this.
Same here... would appreciate a date.
The date is today! :) The new podspecs for each kit for v4.1 have been pushed; let me know if you see any more problems.
Thanks! The 4.1 version works fine when you import directly in swift ( import FBSDKLoginKit ), with bridging header some stuff is undeclared ( e.g. FBSDKLoginButtonDelegate). That is not an issue at all :) just good to know.
I am still getting unresolved identifier error messages for: FBSession, FBAppCall, FBErrorUtility etc.
I have included the imports:
import FBSDKCoreKit import FBSDKLoginKit
Here is my pod file:
//#Uncomment this line to define a global platform for your project platform :ios, '8.3' use_frameworks!
target 'myApp' do link_with ['myApp', 'myAppTests'] pod 'CocoaLumberjack' pod 'FMDB', :git => 'https://github.com/robertmryan/fmdb.git' pod 'FBSDKCoreKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev' pod 'FBSDKLoginKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev' end
I also have "allow non-modular includes in framework modules" turn on to yes in the build settings.
Any ideas what is wrong?
FBSession, FBAppCall, FBErrorUtility are defined in v3.x of the SDK. FBSDKCoreKit is part of v4.x of the SDK and is a breaking change. Take a look at https://developers.facebook.com/docs/ios/upgrading-4.x#3to4
Ye i still have no module found FBSDKCoreKit, tried this in the podfile: pod 'FBSDKCoreKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev' pod 'FBSDKShareKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev' pod 'FBSDKLoginKit', :git => 'https://github.com/facebook/facebook-ios-sdk.git', :branch => 'dev' also tried with pod 'FacebookSDK', '~> 4.1.0' and it didnt work. Could you please post some current guide with steps, how to integrate facebookSDK through PODS right now ? its really crazy to make it work
its just like the pods libraries are completely unseen ;s
It took me awhile to get all my pods working but that is what I did: Firstly look at my pod file above.. I have these included (which I found after reading around):
use_frameworks!
target 'myApp' do
link_with ['yourAppNameHere', 'yourAppTestNameHere']
I also had to go set "allow non-modular includes in framework modules" to yes in the build settings. So google that.
Also: How are you accessing the pods in your code? Are you using the bridgeheader file? As if you are you shouldn't. Instead you have use "import FBSDKCoreKit" statements in the files that you are using the SDK in.
What is the status on this? I still see the errors and I tried everything -- clearing the pods, reinstalling, etc.
This is my podfile:
platform :ios, '8.0'
xcodeproj 'xpatly.xcodeproj'
use_frameworks!
pod 'FBSDKCoreKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKCoreKit.podspec', :branch => 'dev'
pod 'FBSDKShareKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKShareKit.podspec', :branch => 'dev'
pod 'FBSDKLoginKit', :podspec => 'https://raw.githubusercontent.com/facebook/facebook-ios-sdk/dev/FBSDKLoginKit.podspec', :branch => 'dev'
pod 'Alamofire', '~> 1.2'
jorge-3 be specific bud.. what errors specifically?
Look at my post above which states:
Did you: set "allow non-modular includes in framework modules" to yes in the build settings?
Also make sure you use Swift import statements specifically in each class where you are using the pod: eg "import FBSDKCoreKit" as opposed to using Obj-C imports in the bridging header.
Hi @nateuni,
I did everything except the importing, and effectively the errors went away (a good sign) but alas, the FB login button doesn't appear even though no errors appear.
I am basically following this tutorial but adding the Alamofire piece.
You can see my iOS project code here.
Thanks!
-- Jorge
Ah! Turns out I had the wrong code in the View. Works now!
Thanks!
After a few try and reading other issues here, the new version of the SDK is not working with cocoapods and the
use_frameworks!
option needed by swift dependencies.Since this option is mandatory for swift dependencies, it's impossible to do without it and the 4.0 version of Facebook-iOS-SDK is unable to build with it, while the last one (3.23.2) was.
It seems related to the split in 3 frameworks of the SDK, the subfolders dependencies (ie Internal/* in FBSDKCoreKit) are not resolved by the generated pod, leading to 'file not found' errors during the build.