I am coding an iOS 8 app in swift using the FBSDK to allow users to log in to my app. So far I have successfully implemented the login feature using the FBSDK v3.25 in swift using a Bridging-Header.h file and updating the info.plist accordingly to the instructions given on the FB developers website. Now I want to make an app (or update my current one) to FBSDK v4.01 but when I follow the same process of integrating it into my app I get the following errors:
-> FBSDKAppLinkResolver.h
/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9: Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'
/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9: Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'
-> Bridging-Header.h
/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:12:9: Could not build module 'FBSDKCoreKit'
/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:13:9: Could not build module 'FBSDKLoginKit'
/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:12:9: Could not build module 'FBSDKCoreKit'
->FBSDKLoginButton.h
/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h:21:9: Could not build module 'FBSDKCoreKit'
Failed to import bridging header '/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h'
The most obvious thing to note is the last error which says the bridging header cannot be found but it is in the same place as it was for when I was using FBSDK 3.25?
Also, all of the documentation and tutorials on the FaceBook developers website are all in obj-c so finding a solution has been a very frustrating process. Can anyone help diagnose what i am doing wrong? Any help is appreciated!
update
for the time being I have managed to compile my app by following the instructions in the Facebook developers portal and removing all modules from the FBSDK by running the following in terminal
rm -r ~/Documents/FacebookSDK/FBSDKCoreKit.framework/Modules/
rm -r ~/Documents/FacebookSDK/FBSDKLoginKit.framework/Modules/
rm -r ~/Documents/FacebookSDK/FBSDKShareKit.framework/Modules/
this is my workaround until a proper fix is released.
This is a bug and Facebook is currently "assigning this to the appropriate team".
To get updates to this issue follow this link:
https://developers.facebook.com/bugs/362995353893156/
and hit subscribe.
Some people have found success using the answers on this link (none have worked for me):
Facebook iOS8 SDK build module error for FBSDKCoreKit
For those of you trying to compile a swift project with FB cocoaPods.
*BTW, it worked once, only in xCode 7.1 it stopped
Only after playing with everything, I did 2 things:
Added the following code at the end of the pod:
post_install do |installer|
installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
end
end
Remove the 'new and improved' swift imports, and add FB into the obj-C bridging header:
A small screenshot of my bridging header
Try with build settings. Set Allow Non-modular Includes in Framework modules to YES.
Related
I'm trying to integrate my project from Google Analytics to Firebase Analytics. I was using Google Analytics SDK installed with Cococapods. After I do below steps;
Remove 'GoogleAnalytics' from Pod file
Run 'pod install'
Remove bridging header file from the project
Remove bridging header from build settings
I got build error with like average 300 error. Like
Value of type 'CATransition' has no member 'fadeTransition'
I can successfully build when not uninstall Google Analytics SDK so there is no problem with my code. What can cause this problem?
EDIT: I found that deleting bridging header causes the problem, not the Google Analytics SDK.
I found that most of my classes doesn't have import UIKit and somehow, when project has objective-c header, It doesn't need it. However, after I delete it, all of these classes need it. Therefore, implementing
import UIKit
fixed my problem.
I'm trying to add Google Analytics to an iOS app written in Swift. I've followed the guide that adds the frameworks via CocoaPods and added a bridging header but I'm still getting:
Linker command failed with exit code 1
My podfile does have use_frameworks! so I'm wondering if that has anything to do with it... there is no additional information on the Analytics site from what I can see.
EDIT:
I've noticed that after viewing the full error message the following is displayed:
ld: '/Users/simon/Programming/VenueNow/Pods/GoogleUtilities/Libraries/libGTM_NSData+zlib.a(GTMNSData+zlib.o)' does not contain bitcode.
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
And searching for that issue brings up that Google updated to support bit code but hadn't updated the cocoa pods framework at that time.
Go to your build settings and switch the target's settings to ENABLE_BITCODE = YES for now.
I had this same issue. Fortunately you can use Google Analytics with BitCode enabled, but it's a bit confusing due to how Google had set up their CocoaPods support.
There's actually 2 CocoaPods you can use:
'Google/Analytics'
'GoogleAnalytics'
The first one is the "latest" but it's tied to the greater Google pods so it does not support Bitcode. The second one is for Analytics only and does support BitCode. However because the latter does not include extra Google pods some of the instructions on how to set it up are incorrect.
You have to use the v2 method of setting up analytics:
// Inside AppDelegate:
// Optional: automatically send uncaught exceptions to Google Analytics.
GAI.sharedInstance().trackUncaughtExceptions = true
// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
GAI.sharedInstance().dispatchInterval = 20
// Create tracker instance.
let tracker = GAI.sharedInstance().trackerWithTrackingId("XX-XXXXXXXX-Y")
The rest of the Google analytics api you can use the v3 documentation (you don't need to use v2).
The 'Google/Analytics' cocoapod as of this writing still does not support BitCode. See here
Had this issue, but it wasn't related to the bitcode setting. I had somehow ended up with duplicate framework files in the Frameworks folder of my XCode project. I deleted all frameworks files that were red (and duplicates). This solved the "Apple Mach O, Linker Command failed with exit code 1" error.
This worked for me:
you have to remove libPods.a library from Linked Frameworks and
Libraries section of target.
Make sure you open the .xcworkspace file not the project file from xCode Project menu when working with pods. That should solve the issue with linking.
Close Xcode, rename the folder. Then make a new folder with the previous name. Run the project, stop the project. Delete the new folder, rename old folder and re-run.
My iPad Pro simulator is affected with this issue. Its something that makes me upset, so much hard work... hopefully Google works through bugs for the next SDK.
When I changed 'iOS Deployment Target' from 'IOS 10.0' to current one (my phone's) 'iOS 10.2', the problem was gone for me.
Building Settings>Deployment>iOS Deployment Target
I resorted to adding Analytics via cocoa pods again and disabled bit code for now.
Hopefully a future cocoa pods version will support it.
You have another option... install Google Analytics without using CocoaPods:
https://developers.google.com/analytics/devguides/collection/ios/v3/sdk-download
I had same the problem with xcode 7.3. It is because, some of my .h and .m files were added twice.
This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.
Some times appeared if you declare a constant in the header file without static notation.
like this
const int k = 10;
it should be:
static const int k = 10;
Try to remove any trace of cocoapods pods using pod deintegrate then
Run pod install
Build Settings > Enable Bitcode > No
I am trying to add the Facebook SDK to my iOS 9.0 Swift app in Xcode. I did the install according to the FB-dev instructions. However, when I add the header to my AppDelegate.m file import FBSDKCoreKit I keep getting a message saying "No such module 'FBSDKCoreKit'" error .
Based on what I read elsewhere
I have already cleaned the build and re-installed Xcode and updated
my OS X
I have double checked the plist and the framework files FB lists in
the instructions, but nothing has seemed missing.
I have set the "Allow Non-modular Includes in Framework modules"
setting to YES in Build settings.
Nothing seems to work. I do not know where to go from here and have done hours of research trying to find the solution.
When you are importing the frameworks, Make sure you have selected "Copy if needed" . Version after Xcode 6.3 seem to be giving issues if this part is NOT ticked.
I solved this by deleting the Framework and adding it again by right click on the project->Add files..., then choose the framework and SELECT the option to Copy files if needed. It's not what Facebook recommends, but it worked!
I'm using v4.6 of FBSDK and Xcode 7 beta 6.
Hope it helps you and everyone else who's facing the same problem :)
With CocoaPods, swift 2.1, and iOS 9, I tried adding it to the bridge header and it works fine, for example:
#ifndef MY_Bridge_Header_h
#define MY_Bridge_Header_h
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
// ... other imports
#endif /* MY_Bridge_Header_h */
I had errors following alongside the AppCoda tutorial which is not fully up to date. I recommend following Facebooks own instructions. The issue for me was that I had to add the frameworks to my project and then add sdk search path. After that I could import without an error.
I follow all the steps in This Tutorial and/or Facebook SDK Documentation to install Facebook Login on my App, but when I run the code I get an error. although Facebook mention I can just use import (Swift) to include the framework, I try to do it the old fashion as well with Objective-C Bridge Header.
Error:
'FBSDKLoginKit/FBSDKLoginKit.h' file not found
ScreenshotAs you can see the bridge.h is being read by the compiler, but due to internal file error it will throw error.
Bridge.h In Xcode 6 you don't require bridge header file, I could just do it with import
#import <FBSDKLoginKit/FBSDKLoginKit.h>
This problem is due to Xcode 7 Beta, I have tried to do it on Xcode 6 and it worked perfectly with just an import FBSDKLoginKit. Can anyone tell me a hack around this? or if there is a way to convert my Swift 2 code back to 1.4 and work on Xcode 6.
I had the same problem.
Managed to sort the directory by adding the Facebook SDK in "Framework Search Path".
Target -> Build Settings -> Framework Search Paths -> + /Users//Documents/FacebookSDK
it works!
=]
For those using cocoapods the solution for me was actually adding FBSDKCoreKit to podfile:
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
The facebook documentation is incomplete, they dont mention anything about including FBSDKCoreKit pod reference.
For [login,sharekit,corekit].h file not found error , My solution was:
changing framework searchpath of RCTFBSDK (inside library of the project)
~/Documents/FacebookSDK
to
$(HOME)/Documents/FacebookSDK
I have the same issue and recognized, that my old XCode 6 projects worked with the Facebook frameworks.
So i try the following workaround and that fixed the problem. however i don't know why:
Facebook iOS SDK 4.2
Create a fresh project in XCode 6
Link the Facebook Frameworks to your project as described in the docs
Close the project and reopen it in XCode 7
The "To Swift 2 Converter" should open within the project - Convert the project to Swift 2
Run the project - in my case everything works fine.
After that i copied my "old" Swift 2 Files into the new project. The app starts without any issues.
I observed the changes by the converter, but can't recognized any change depending the Facebook frameworks.
Had the same issue, instead of updating the search path
I solved it by removing the Frameworks from the project and then adding them checking the Copy items if needed box
My header files looks this
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
You can simply put ~/Documents/FacebookSDK in Framework Search Paths and it will work for any user
this is a known bug: https://developers.facebook.com/bugs/362995353893156/
Check out this solution: Facebook iOS8 SDK build module error for FBSDKCoreKit
I downloaded the new iOS Parse API (1.6.4) and tried to build my project. When I do, I get this error:
Undefined symbols for architecture arm64" "_BFTaskMultipleExceptionsException", referenced from:
___53+[PFObject(Private) deleteAllAsync:withSessionToken:]_block_invoke214 in Parse(PFObject.o)
___65+[PFObject(Private) _deepSaveAsync:withCurrentUser:sessionToken:]_block_invoke311 in Parse(PFObject.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Screenshot:
Temporary workaround for Parse 1.6.4 and Facebook SDK 3.23:
Add to your AppDelegate.m or another class following constant after imports and before implementation section:
NSString *const BFTaskMultipleExceptionsException = #"BFMultipleExceptionsException";
#interface IPAppDelegate ()
#end
#implementation IPAppDelegate
It should solve the problem until it'll be solved on Parse/Facebook side.
--
Update: This solution is only for Facebook and Parse SDK versions that listed above and these versions right now are outdated.
New Parse SDK 1.7.4 works correct with new Facebook SDK 4.0 and there shouldn't be such a problem.
I was able to figure out the URL for anyone that needs Parse iOS v1.6.3.
https://parse.com/downloads/ios/parse-library/1.6.3
I can confirm that everything compiles properly using 1.6.3.
Placing
NSString *const BFTaskMultipleExceptionsException = #"BFMultipleExceptionsException";
in the App Delegate as suggested by Sergey Surkov in between the imports and the implementation and then adding libstdc++.6.dylib in build phases worked for me. Please also view https://stackoverflow.com/a/27628797/1036945
I've had the exact same problem using the latest SDKs from Parse (1.7.4) and Facebook (4.2.0). The problem is caused by the Bolts.framework included in both Parse and Facebook SDKs. For some reason the Bolts framework in Parse is always newer than the one included in the Facebook SDK.
After many-many attempts at installing, removing and re-installing these SDKs, using the drag and drop method and via Cocoapods, I finally managed to overcome this issue by undertaking the following steps:
I removed completely any instance of the Parse, Facebook and Bolts frameworks from my project;
I re-added the FBSDKCoreKit framework (and the ShareKit and LoginKit for the needs of my project) following the steps on the Facebook developer page: https://developers.facebook.com/docs/ios/getting-started/
Make sure NOT to copy the items to your project.
I re-added the Parse framework to the project using the drag-and-drop method. I also added the ParseFacebookUtilsV4 framework because I needed it to create users via Facebook Login.
This was the most important step that solved everything: I added the Bolts.framework provided by Parse by dragging it to the project, but making sure NOT to copy it to the project (just like with the FBSDKCoreKit framework, I deselected the "Copy items into destination group's folder." option. If you copy it to the project folder, the project won't build.
These steps finally solved all my problems.
if you are using cocoapods try pod update Bolts
EDIT2: FacebookSDK Update 3.23.2 resolves this issue and includes Bolts 1.1.4: https://developers.facebook.com/resources/facebook-ios-sdk-3.23.2.pkg
EDIT:
Drop -ObjC "Other Linker Flag" from your Build settings.
Bolts.framework is not necessary with Parse if Facebook SDK is integrated.
As of Facebook iOS SDK 3.14 bolts.framework is included. https://developers.facebook.com/docs/ios/upgrading-3.x
Try removing your manual instance of bolts.framework.
Just to put the record straight.
The issue is caused because of a conflict with the Bolts framework between the Facebook SDK Bolts and the Parse bolts framework. A temporary solution to get around this issue is to use Cocoapods for your Facebook SDK dependency which will help while a fix is worked on.
The bug has been acknowledged by Facebook & is being assigned to the appropriate team for fixing.
Please follow https://developers.facebook.com/bugs/383331175179417/ for the updates.
make sure the facebook sdk framework and bolts framework (comes with fb sdk) is imported into your project.
i got similar error ("...is not a dylib" and "Undefined symbols for architecture") because i dragged the whole parse folder ("parse-library-1.7.4-2") into my xcode project, when i should have dragged only the frameworks i needed ("Bolts.framework" and "Parse.framework"). deleted the parse folder, dragged over the two frameworks, then everything works as expected :)
I had the exact same problem. Updating Bolts to 1.1.4 solved it for me (Bolts was 1.1.3 before).
If you use cocoapods, change or add this line to your podfile
pod 'Bolts', '1.1.4'
If not, just download it here : https://github.com/BoltsFramework/Bolts-iOS/releases
Try downloading the latest SDK and replacing all of the Parse frameworks with the latest version.