可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am trying to add the Facebook login feature using FBSDKCoreKit
and FBSDKLogin
. When I try to import these two framework to my AppDelegate
file, it shows error which is
"No such module 'FBSDKCoreKit'".
I changed Allow Non-modular Includes In Framework Modules
from NO
to YES
, but the error is still there.
I need help with coming up with a solution to resolve the error.
回答1:
I resolved this problem by adding FacebookSDK
Directory path to the "Framework Search Paths"
Go to Build Settings and search for "framework search"
回答2:
I resolved No such module 'FrameworkName'
issue with following steps:
1) Create a group, call it Framework
(optional, best practice)
2) Drag desired SDK(s) from Original SDK path to Framework
, in your case FBSDKCoreKit
and FBSDKLoginKit
3) When the dialog pops 'Choose options for adding these files:', choose following:
Additional step for Facebook SDK version 4.0:
4) Select the target in the project editor and click Build Settings, change Framework Search Paths to: ~/Documents/FacebookSDKDirectoryName
回答3:
I'd like to suggest one of the easiest way.
- put your mouse on your project ( in xcode)
- and right click > Add Files to...
- Add your framework files.
- you also need to change Allow Non-modular Includes In Framework Modules setting from NO to YES,
Dada! Works like a charm!
回答4:
if you are using pods then just delete all pod file and related folders and start from the first step
init pod
.
then open that pod file and add following framework
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
then pod install
and import it to the swift file and enjoy :)
and if you are directly add folder to your project then make sure that 'copy if needed' is marked
回答5:
It's the usual suspects.
Check your Frameworks folder. Check Project -> Build Phases -> Link Binary with Libraries, and make sure FBSDKCoreKit
and FBSDKLoginKit
are included.
If they're there, and the error still exists, tap on each framework, and make sure Target Membership
is checked under File inspector.
回答6:
I have solved this problem by copying the frameworks to the application's folder. Your application does not know the path of the frameworks.
回答7:
I have solved this problem by typing import FBSDKLoginKit
Dont copy!! just write.
Hope it Helps
回答8:
What fixed it for me was removing the pods folder and running the install command again:
rm -Rf Pods
pod install
回答9:
Looks like you also have to add to the Bridging-Header.h file:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
The use of Bridging-Header.h is only needed when you use the Objective-C version of the framework files. However, the Swift tutorials on the Facebook site do leave out key steps for using the Swift-built framework files, specifically the AppDelegate adjustments after importing FBSDKCoreKit there.
回答10:
In AppDelegate import:
import FacebookCore
import FacebookLogin
and add:
func application(_ application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
SDKApplicationDelegate.shared.application(application,
didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(_ app: UIApplication, open url: URL, options:
[UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return SDKApplicationDelegate.shared.application(app, open: url,
options: options)
}
回答11:
This fixed it for me: Make sure to Clean and Build your project after running the Pod Install.
From menu: Product/ clean & then build.
回答12:
Please try opening the project using .xcworkspce not with .xcodeproj
As workspace load all the depencies.