Related
I'm trying to install the MapboxGeocoding framework with Cocoapods and Xcode9. Unfortunately Xcode can't find the module. It shows me the following error: Cannot load underlying module for 'MapboxGeocoder'
The pod file looks as the following:
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
target 'FrameworkTest' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'MapboxGeocoder.swift', '~> 0.7'
# Pods for FrameworkTest
end
I checked also the build settings of the Xcode Project. It looks like the following:
Framework Search Path
Finally nothing worked for me. Any suggestions to solve this problem?
PS: The normal MapBox Framework works well with cocoapods
I guess your framework header search path is missing this path. Try adding $(inherited) $(PROJECT_DIR) $(PROJECT_DIR)/YourProjectFramework folder in Framework search path
Hope this helps you!
I downloaded a project from GitHub, then pod the following files, some of which are written by OBJ-C and I used a bridge header.
pod ‘SnapKit’
pod ‘MJRefresh’
pod ‘Alamofire’
pod ‘Kingfisher’
pod ‘MBProgressHUD’
pod ‘pop’
pod ‘EVReflection’
pod ‘StreamingKit’
pod ‘iCarousel’
pod ‘ReflectionView’
When I run the project with Xcode 9.0 beta 2, but unfortunately the error log as follows :
error: failed to emit precompiled header
'/var/folders/kd/4gh0_kxx3jx4thjb_sssmmcw0000gn/T/EvoRadio-Bridging-Header-97bd5f.pch'
for bridging header
'/Users/ringo/Downloads/EvoRadio-master/EvoRadio/Resources/EvoRadio-Bridging-Header.h'
I have googled, but no such issue.The error means it needs a PCH file?
This is my .pch header configuration:
It can't solve it.
How to make it?
I have tried all of the above steps mentioned in the answers but nothing worked for me, the problem was basically with the deployment target version for the project and in the podfile.
In my project deployment target was 10.0 while in my podfile it was 11.0.
Note this can also happen if your bridging header imports Objective-C code that itself imports your app's Swift module via myproject-Swift.h. The solution is to use forward declarations for your Swift types and import the project Swift module in the .m file.
#class MySwiftClass or...
typedef NS_ENUM(NSInteger, MySwiftEnumType)
MySwiftEnumType is the lowest level name even for classes. So Swift enum MyClass.MySwiftEnumType becomes just MySwiftEnumType
Make sure you're opening the proper project workspace, otherwise, the Podfile may not have all the resources it needs to compile.
I saw this same error on a project that had been working fine previously.
I discovered that I had accidentally opened the ProjectName.xcodeproj file rather than the ProjectName.xcworkspace file. Opened the xcworkspace file and presto, project was working again!
I also got exact same issue (Xcode9 beta 6) after I added cocoa pods for Encrypted Core Data.
This is my PodFile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git'
target 'Root' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Root
target 'RootTests' do
inherit! :search_paths
# Pods for testing
end
target 'RootUITests' do
inherit! :search_paths
# Pods for testing
end
end
Solution:
1 I added $(inherited) non-recursive to Search Path -> Header Search Paths
2 Then added ${PODS_ROOT} recursive to Search Path -> User Header Search Paths
Both the above in my projects' target build settings.
Please have a look at these SO answers:
1 Inherit Header Search Paths
2 Inherit User Search Paths
For me, this problem occurred when I added new build configuration and scheme to the existing project.
The solution was to run pod install on newly created scheme. After that, project was built successfully.
I had this issue just when compiling for a simulator not for a hardware device. There were two compile error like:
error: failed to emit precompiled header 'Bridging-Header-97bd5f.pch' for bridging header 'Bridging-Header.h'
Could not find ActionSheetPicker_3_0/ActionSheetPicker.h in Bridging Header (but it was declared there)
After hours of research and try and errors it turned out, that there was no valid architecture set in the project to compile for simulators.
At Project -> Build Settings -> User-Defined -> VALID_ARCHS add the architecture x86_64 to enable compilation for simulators.
XCode can build seccessful in the some target, but the other target can not.
Finally, I found that Header Search Paths is not the same. (Path: Target > Build Settings > Search Paths > Header Search Paths > add item)
I copied & pasted the path from the successful target. I made it. Bravo.
You can try this solution. I have solved the same problem by this way.
Product > Scheme > Edit Scheme > Select "Build" on Left Menu > Find implicit dependencies
Under the build tab, check 'Find implicit dependencies':
Then make a clean and build again.
In my case I had the same compiler error with additional errors like "Unknown type" in one of my project files, So I just added this to the problematic file, and it solved it instantly.
#import <UIKit/UIKit.h>
My experience with this is that Xcode is unable to find header files for pods/frameworks imported in the project.
My Project experience with this:
Updating Xcode9.2 - 9.3 where many cocoapods had to be updated due to implicit definitions now unavailable or being outdated.
I had changed the Podfile to now include 'use_frameworks!'. Following this and after dealing with other compile issues I found the error you are experiencing. I believe adding 'use_frameworks! was preventing some pods with support prior to iOS 8 from compiling correctly. Steps I took to correct this issue:
I tried deleting the Pods/ directory using cocoa pod deintegrate
I then open project with Xcode and cleaned the build folder and the project. (delete content within derived data folder)
I then pod install again but the issue persisted.
Ultimately I removed the use_frameworks line in Podfile and then repeated steps 1-3 and the project was now able to find the missing header files and the issue never presented it self again.
In my case;
Under Target/Build Settings/
Product_Name section was different than $(TARGET_NAME)
When I changed it $(TARGET_NAME), it was resolved.
In my case, I found that it was because I did not config the Framework Search Paths in Release Tab. Here is the screenshot:
After adding this path, it works.
For my case I had a typo in folder name "Supporing FIles" instead of "Supporting Files".
I also suffered from this after I updated new Xcode. After several hours of investigation, i found that if you have multiple targets, you now have to add more targets in pod file in Xcode 10. So your code should be like this:
platform :ios, '9.0'
target 'EvoRadio' do
pod ‘SnapKit’
pod ‘MJRefresh’
pod ‘Alamofire’
pod ‘Kingfisher’
pod ‘MBProgressHUD’
pod ‘pop’
pod ‘EVReflection’
pod ‘StreamingKit’
pod ‘iCarousel’
pod ‘ReflectionView’
target 'EvoRadio2ndtarget' # add your second target
end
I found that in Xcode 9 you don't need to add, but in Xcode 10 you need to add this. Hope this helps.
Deleting Podfile.lock and re-running pod install fixed this for me.
There are so many reasons and things can do, like:
Restart Xcode, Clean, Build
Remove Pods directory and pod install
Check the missing file is added to your pod file
Check the missing file is added to you bridging header
Change the header settings like here iOS - Build fails with CocoaPods cannot find header files
The only one works for me is the accepted answer in Xcode 9 - failed to emit precompiled header.
platform :ios, '11.0' in podfile should match the target in the project
I had same scenario, make sure for the file A that you have included in YourProjectName-Bridging-Header.h
if it uses some other class(s), then those other classes are also included before that File A
In my case, I was building with the wrong scheme (Top-Left menu).
For Xcode 11 I had an issue with the "Security.framework". I removed this dependency, then re added it. Ultimately fixed the other problems
I got this error after renaming the existing Xcode project configuration in which I had another Xcode project imported.
To fix it, you have to rename the same configuration in the imported project as well.
Since I have been stuck in this issue for 2 working days , I would like to share my issue for you because may be future searchers are facing my problem
I was getting the mentioned error when running with command line , and I found that the command I was writing was for running .xcodeproj ,, but to run a .xcworkspace you have to write the following command
xcodebuild -workspace PROJECTNAME.xcworkspace clean archive
-archivePath build/PROJECTNAME -scheme SCHEMENAME
In my case, all was good. I had just forgotten to add '.h' in import added to the bridging header file
Was
import 'Test'
Required
import 'Test.h'
Had this error in a bit different situation. Added SWIFT file in one project from another one. Checked names of bridging headers, routes - nothing helped. The reason of the error was that I did not import some of my custom classes in the bridging header. Imported - and it worked!
I am implementing FB Login so i Downloaded the SDK from https://developers.facebook.com/docs/ios.
then i drag n down FBSDKCoreKit, FBSDKLoginKit and FBSDKShareKit frameworks into my project.
when i ran project it works fine. but when i closed and reopen it, then "FBSDKCoreKit/FBSDKCoreKit.h not found error" appears. then again i copy paste FBSDKCoreKit framework into my project's library
and error disappear and this process continues. anyone faced this problem before?
what should i do to solve this error?
Make sure to follow this step:
Deselect Copy items into destination group's folder.
https://developers.facebook.com/docs/ios/getting-started/
Also, in your Build Settings, look at this field: "Framework Search Paths"
You should have something like this:
/Users/[username]/Documents/FacebookSDK
or for a more general config
~/Documents/FacebookSDK
Also, look at Finder and make sure that the framework is actually there
After updating Cocoapods 1.0.0, I deleted pod.lock and installed the current stable pod versions (4.7.0 to 4.11.0) of FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit
Then i encounter the same error. What i did was:
Added Header Search Paths Build Settings in Xcode:
"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\"
"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\"
"${PODS_ROOT}/Headers/Public/FBSDKCoreKit\"
"${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"
Then i still had error for another file. Because XCode is using prebuild frameworks.
FBSDKCoreKit/FBSDKCopying.h not found
Clean Build -> ⇧⌘K (Shift + Command + K) - to clean builded frameworks.
Clean Build Folder -> ⌥⇧⌘K (Option+Shift+Command+K)
Close Xcode // important! - Otherwise it recreate the DerivedData for the current open project automatically
Run this command in terminal
rm -rf ~/Library/Developer/Xcode/DerivedData
Open XCode and build successfully
I got to solve 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. I know it's not what Facebook recommends, but I couldn't make it work doing that, but this way 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 :)
This also took me hours of pain! Finally I found the root problem.
The Facebook SDK MUST be located at ~/Documents/FacebookSDK
This is because in the RCTFBSDK project this path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDK project (it will be shown in the error console)!
FB developers say don't select copy files. Which creates problem. But I did opposite.
I selected copy items if needed. It copied Frameworks in my project. Also automatically Search Path was added by xcode 7.2.
Also double check if there is nothing in Framework Search Pathsunder Search Paths under Build Settings fields, then just add $(PROJECT_DIR) which is equal to /Users/user/Documents/....PROJECT..DIR...
Compiled in 2 projects successfully.
I had to move FacebookSDK path in Framework Search Paths above $(PROJECT_DIR)
$(SRCROOT)/../../../Documents/FacebookSDK
$(inherited)
$(PROJECT_DIR)
Xcode 11 + CocoaPods solution
In root of your project, i.e. the same path where you have MyApp.xcworkspace open Terminal and init pod's pod init, then add the required FBSDK pods - your Podfile should look something like that:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
end
Now in your Terminal pod install and open MyApp.xcworkspace (which is not MyApp.xcodeproj). Go to MyApp -> Build Phases -> Link Binary with Libraries and you should see at the bottom of the list of frameworks Pods_MyApp.framework. If you'd click + below Pods_MyApp.framework you should in new window below Workspace a list of Pods where all related to FBSDK should be.
Note: Make sure you're installing FBSDK, not Facebook SDK, because the second one is outdated.
If any of the above answers didn't work, try this:
Open your ~/Documents/FacebookSDK folder.
Check if there is this cloud icon right of the filenames:
If so, macOS removed your files from your computer and uploaded them to iCloud! (thanks Apple)
You can:
Click on all the cloud icons, it will download the files back
Disable Storage Optimization on your mac to prevent it from happening again
For React Native devs:
Recommended steps to be done :
1.Make sure that the Facebook SDK frameworks are installed in ~/Documents/FacebookSDK.
2)Make sure that FBSDK[Core, Login, Share]Kit.framework show up in
the Link Binary with Libraries section of your build target's Build
Phases.
3)Make sure Framework Search Path of your
build target's Build Settings is
$(HOME)/Documents/FacebookSDK
instead of
~/Documents/FacebookSDK
If it still doesn't work for you then:
1)sudo chmod -R 755 ~/Documents/FacebookSDK
2) set the path of framework search path of RCTFBSDK.xcodeproj to
$(HOME)/Documents/FacebookSDK
(under libraries of your project folder )
set RCTFBSDK framework searchpath as here
clean your project (command+ shift + k ) and build.
Solution to the problem if your FacebookSDK is different than
~/Documents/FacebookSDK
Because you don't want iCloud Drive to load up with FacebookSDK;
you have to change the "Framework Search Paths" for the added
react-native-fbsdk
This is because in the RCTFBSDK.xcodeproj inside Libraires; path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDK project.
Select the Project
Libraries
Select "RCTFBSDK.xcodeproj"
Build Settings
Add your custom path in "Framework Search Paths"
eg: /Users/rajanmaharjan/FacebookSDK
Clean Build -> ⇧⌘K (Shift + Command + K) - to clean build frameworks.
Build the project; it should build successfully.
I had the same problem. I fixed it by using quotes around my framework search path value i.e. "/Users/.....". Obviously, I have some spaces in my file paths.
I have the same issue.I use Facebook SDK version 4.10.0.I known my solution is not good but worked for me. I changed the Facebook source code.
Changed the import file path from #import <FBSDKCoreKit/FBSDKCoreKit+Internal.h> to #import <FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h>
Using CocoaPods, the only thing that worked for me was:
Update Header Search Paths ( NOT Framework Search Paths ) under Build Settings in Xcode:
- "\"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\"",
- "\"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\"",
+ "\"${PODS_ROOT}/Headers/Public/FBSDKCoreKit\"",
+ "\"${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"",
Add the missing header(s?):
cd Pods/Headers/Public/FBSDKCoreKit/FBSDKCoreKit/ && ln -s ../../../../FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h FBSDKCoreKit+Internal.h
Edit: point 2. needs apparently to be repeated after each following call to pod install.
For Xcode 7.3, the below worked for me.
Follow the steps mentioned on FB's guide and additionally do the below:
step 1. go to Document/FacebookSDK folder
step 2. Click FBSDKCoreKit.framework
step 3. In this folder Remove Modules folder and then drag and drop in your Xcode Project.
References : https://stackoverflow.com/a/29532202
Thanks
For people moving from Carthage to Cocoapods make sure to remove the Carthage references of the FBSDKCoreKit from the Link Binary With Libraries under Build Phases option.
I had a similar issue, and could not resolve the compiler error anyway.
I followed and performed the exact integration steps a few times, until I noticed that I have a copy of the FBSDKCoreKit.framework inside my project folder (happened probably by a mistake). In addition the Framework Search Paths already contains $(PROJECT_DIR) besides /Users/{username}/Documents/FacebookSDK.
So I've removed the copy of the FBSDKCoreKit.framework from the project's directory and now everything works fine.
I ran into this issue last night, and wanted to post my solution just in case someone else has the same problem. My problem was my app was building and running fine in the sim and on my device, however the build would fail because of FBSDKCoreKit whenever I tried to run my unit tests. It took my about 30 minutes to find the problem, and I felt like a dummy when I did.
Make sure that the FBSDKCoreKit bundle is targeted for your tests as well, and not just your regular application build.
I had this problem when upgrading to Xcode 8 and was able to solve it by changing
#import <FBSDKCoreKit / FBSDKCoreKit.h>
to
#import <FBSDKCoreKit/FBSDKCoreKit.h>
When you add the directory to your Build Settings -> "Framework Search Paths", make sure you add it to both Debug AND Release.
Silly error but if you're new to iOS dev in xcode you could miss this.
Personally I had trouble with spaces in various paths, including app name. Removing spaces (or adding "" everywhere to secure paths) solved the problem.
I had similar issue. Fix consisted for me in selecting: "COPY FILES IF NECESSARY" when manually adding the different frameworks into XCode framework.
I dragged the framework to the Framework folder inside xcode, chose to copy files if needed and all worked fine without any other configuration change.
I have installed react-native-fbsdk and link using react-native-link react-native-fbsdk.
Follow instruction of following link
https://developers.facebook.com/docs/react-native/configure-ios
This provide to link react-native library using ios_setup.js There are following step which i have followed.
Setup on facebook developer account.
Install the file ios_setup.js by executing the following command in
a command prompt at your project's root folder.
curl -O https://raw.githubusercontent.com/facebook/react-native-fbsdk/master/bin/ios_setup.js
Install the plist package, the xcode package, and the adm-zip package, by executing the following command.
npm install plist xcode adm-zip
Run the script ios_setup.js by executing the following command, and insert your app's App ID and App Name. If the name of your app is more than one word long, then enclose it between quotation marks.
node ios_setup.js [App ID] [App Name]
When run node ios_setup.js it wll automatically link all files in ios.
After troubleshooting using several answers here. This is what I did.
I changed ~/Documents/FacebookSDK to "$(HOME)/Documents/FacebookSDK" note: I used quotes "
I moved "$(HOME)/Documents/FacebookSDK" to the top of the list in header search paths.
Had a same error in FBSDKLoginKit
If you use multiple pod projects
install! 'cocoapods',
:generate_multiple_pod_projects => true
Then you should force cocoapods to put all of FBSDK pods into a same project to make private headers visible
pod 'FBSDKCoreKit', '5.11.0', :project_name => 'FBSDK'
pod 'Bolts', '1.9.0', :project_name => 'FBSDK'
pod 'FBSDKShareKit', '5.11.0', :project_name => 'FBSDK'
pod 'FBSDKLoginKit', '5.11.0', :project_name => 'FBSDK'
Xcode with Facebook and iOS working - Step By Step
After much frustration I got my Iphone game building just fine. Following a combination of Ixgee's solution, and other solutions.
Fixes - FBSDKCoreKit.h not found and other related issues
I'm using Unity and Facebook SDK v11
Unity -> ExternalDependencyManager -> IOS Resolver Settings - make it build to a Xcode project and make sure all the checkboxes are checked.
MacOS -> move project to Mac. In Terminal in the project directory do the ‘sudo chmod +x process_symbols.sh’
2.5 Make sure you have cocoa pods installed. In Terminal type ‘sudo gem install cocoapods’
MacOS->Podfile - the pod file in your project should look like this for Facebook SDK 11
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
target 'UnityFramework' do
pod 'FBSDKCoreKit', '~> 11.1.0', :modular_headers => true
pod 'FBSDKCoreKit_Basics', '~> 11.1.0'
pod 'FBSDKGamingServicesKit', '~> 11.1.0'
pod 'FBSDKLoginKit', '~> 11.1.0'
pod 'FBSDKShareKit', '~> 11.1.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static
use_frameworks!
[Only needs to be done once. If your Mac processor uses an ARM processor (like the M1)]] Terminal -> Type ‘sudo arch -x86_64 gem install ffi’
Solution from - https://github.com/CocoaPods/CocoaPods/issues/10723 [super helpful!]
[If your Mac processor uses an ARM processor (like the M1)] Terminal -> ‘arch -x86_64 pod install’
Or
[If your Mac processor uses an x86 processor (like an Intel)] Terminal -> ‘pod install’
Once the Pod Install is successful, double click the newly created ‘Unity-iPhone.xcworkspace’ in your project directory to open the workspace in Xcode.
Xcode->The folder option -> Unity-IPhone-> under Projects select ‘UnityFramework’-> select ‘Build Phases’ then drag the ‘> Headers’ above the ‘> Compile Sources’
-Full details here (https://forum.unity.com/threads/xcode-version-13-3-13e113-error-cycle-in-dependencies.1268720/)
Xcode -> In the Unity-phone - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: YES
In the UnityFramework - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: NO
Source - Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks'
VOILA! It builds to your iPhone with Facebook SDK Dependencies good to go on iOS!!!
->Builds Configuration.
-> Framework Search paths.
put the FacebookSDK directory in my case
~/Documents/FacebookSDK in :
Debugging,
Any architecture I Any Sdk,
Release.
especially this error because there no path in Any architecture I Any Sdk
in my case
~ / Documents / FacebookSDK
and it should be noted that the FacebookSDK folder must be in Domuments
Example
https://photos.app.goo.gl/5bD4d39a11AalYsx1
Change the /Users/[username]/Documents/FacebookSDK/ directory to Documents/FacebookSDK like so:
So here's my procedure. I create a new Podfile in the project directory, then I added the following
platform :ios, '9.0'
use_frameworks!
target 'CPod' do
pod 'AFNetworking', '~> 2.5'
pod 'ORStackView', '~> 2.0'
pod 'SwiftyJSON', '~> 2.1'
end
I fire off pod install, and everything goes well, open up the xcworkspace. I then go over to ViewController.swift and if I try to import a pod I get No such module 'SwiftyJSON', if I were to do import SwiftyJSON. Any ideas?
EDIT: SwiftyJSON is a Swift based module, not Obj-C
Try adding the Pods framework to your build scheme and building the framework. After you've built it, build/run your project.
Steps:
Scheme menu > Manage Schemes > check Pods > Close
Select Pods from the scheme menu.
Build Pods.
Select your project from the same menu, then build/run it.
You must reopen project .xcworkspace file(not .xcodeproj) after install your podfile.
Clone the repo with CocoaPods
Open YourWorkspace/YourApplication.xcworkspace
Select the app u want to run Add SwiftyJSON.framework in embedded
binaries for that project Hit Run
Happy Coding :)
You may also try re-installing pods using:
pod deintegrate
and then
pod install
This fixed this issue for me
Press Command+Option+Shift+K and then Run your app, you will see a magic.
Or from the menu -> Product, press Option on your keyboard and you'll see Clean Build Folder.
It's looking funny that how could Xcode do those things with us but same thing happened to me when I used a Swift library using Pod and after too much struggle I ended up with Clean Build Folder.
Not sure if this would still be helpful for others. But, in my case, it ended up being a silly mistake of not referencing dependencies from the .podspec file.
We have an application with multiple internal libraries, and those libraries also have dependencies on each other - which we accounted for the in the Podfiles... but NOT in the podspecs.
So, even though our Podfiles had:
Application / Podfile
# Development Pods
pod 'ConsumingLibrary ', :path => '../ios-consuming-lib'
pod 'DependentLibrary1', :path => '../ios-library-one'
pod 'CommonCoreLibrary', :path => '../ios-common-core-lib'
ConsumingLibrary / Podfile
# Development Pods
pod 'DependentLibrary1', :path => '../ios-library-one'
pod 'CommonCoreLibrary', :path => '../ios-common-core-lib'
Needed to also call it out in the .podspec's:
ConsumingLibrary / ConsumingLibrary.podspec
# TODO
# Add here any resources to be exported.
s.dependency 'DependentLibrary1', '~> 0.1.0-RC'
DependentLibrary1 / DependentLibrary1.podspec
# TODO
# Add here any resources to be exported.
s.dependency 'CommonCoreLibrary', '~> 0.1.0-RC'
I think I wasted about 2 hours trying to figure out why I could build ConsumingLibrary & run tests, but as soon as I built the app, that consumed all three libraries - I kept getting:
No such module 'DependentLibrary1'
In my case it was because I opened xcodeproj instead of the correct xcworkspace.
Had this issue, too. I noticed the folder in Pods/broken_framework_name for framework which produced an error was empty even after pod install or pod update. So, for me those steps helped:
close XCode completely
remove DerivedData
remove Podfile.lock. Before doing it, make sure your pods are set to specific versions and it will not cause unwanted code updates
run pod deintegrate
remove .xcworkspace file
probably optional step: I had general line use_frameworks! written before all targets, but included it also in target in which I had an error
run pod install
After all steps I noticed missing framework files finally appeared back and build was working again.
Try using pod update after pod install command which will solve problem of No such module.
I just tried and it working fine.
Thanks,
Ratneshwar
Those who working with multiple targets , please don't forget to add this line in pods
def shared_pods
pod 'SSKeychain', '~> 0.1.4'
pod 'INAppStoreWindow', :head
pod 'AFNetworking', '1.1.0'
pod 'Reachability', '~> 3.1.0'
pod 'KSADNTwitterFormatter', '~> 0.1.0'
pod 'MASShortcut', '~> 1.1'
pod 'MagicalRecord', '2.1'
pod 'MASPreferences', '~> 1.0'
end
target 'Target_Name' do
shared_pods
end
target 'Target_Name_Two' do
shared_pods
end
Sometimes happens when you have an obj-c pod within a swift project (even when you use the use_frameworks! in the .podfile).
If you're sure the pod is installed and you are still getting No such module, try this:
Go to Pods project in Xcode
Pods
Right click on the affected pod
Show in finder
There should be a package file with .framework suffix. Create a folder Modules in it. In this folder create a file called module.modulemap with code:
framework module MODULE_NAME_HERE {
umbrella header "MODULE_NAME_HERE.h"
export *
module * { export * }
link framework LINKED_FRAMEWORKS_AND_LIBRARIES_THE_POD_NEEDS_HERE
link framework "AdSupport"
link "c++"
link "z"
}
Rebuild and you should be ok.
As #jakub-truhlář wrote, the root issue is the missing module.modulemap file due to some concurrency issue mixing Swift and Objective-C libraries, but instead of creating those files manually, would be better to try multiple times cleaning the Derived Data and build your project. When the project is successfully built then commit module.modulemap files to your repository to avoid to lose those files for example changing the current branch.
I faced the same problem in a swift framework I developed. The framework had a dependency of git project and the framework itself added as a pod to my main project. So, ideally the dependency has been specified in podspec file and Podfile as well.
I didn't faced the problem when accessing through the my main project but when I open the framework standalone it was throwing "No such module" error.
The root cause is, the base configurations is set with the path which points towards my main project instead of the framework itself because I ran podinstall first in my main project and then in the framework project.
Eg: in the project file it was like
0091AB0C861D71C94ADD7240 /* Pods-myframework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-myframework.release.xcconfig"; path = "../../Apps/MyMainProject/Pods/Target Support Files/Pods-myframework/Pods-myframework.release.xcconfig"; sourceTree = ""; };
After doing the below mentioned fix,
4444F5B1B35F066E57F96782 /* Pods-myframework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-myframework.release.xcconfig"; path = "Pods/Target Support Files/Pods-myframework/Pods-myframework.release.xcconfig"; sourceTree = ""; };
To fix the error,
Project file -> Configurations -> Set all the configurations set to
none.
Remove Pods folder and Podfile.lock.
Run 'pod install' first in the framework project direcory and then do pod install in main project directory.
I get some warning when pod install: '... target overrides the FRAMEWORK_SEARCH_PATHS build setting defined in ...'.
Fix it and enjoy.
Reference: target overrides the FRAMEWORK_SEARCH_PATHS build settings.
Another way this issue can manifest: if you have multiple targets with different platforms (e.g. iOS and watchOS) you need to make sure your podfile specifies the correct platform for each target. Otherwise Cocoapods might be building the right pod but for wrong platform, leading to the "no such module" error.
You can fix it just by specifying the correct platforms e.g.
# global platform
platform :ios, '11.0'
target 'My Framework' do
use_frameworks!
pod 'RxSwift', '~> 5.1'
end
target 'My Framework (watchOS)' do
# override global platform for this target
platform :watchos, '4.0'
use_frameworks!
pod 'RxSwift', '~> 5.1'
end
i fixed it by check "Find Implicit Dependencies" to true.
Go to Edit Scheme -> Build Tab -> set Find Implicit Dependencies = true.
and rebuild.
Adding link "c++" in the framework module.modulemap file worked for me
I had this problem when I opened XCode and then selected the workspace of my project via file->open recent.
I found that I had two .xcworkspace files on my filesystem for the same workspace/project.
Opening XCode by double clicking on the correct .xcworkspace file did the trick.
The correct one is the one that works.
I later deleted the wrong one.
I just updated particular dependencies in terminal
Go to project folder then run below command
pod update your pod name
For me I need to do
pod update ReachabilitySwift
Had this issue while adding CocoaPods into an old project, which already had manually included libs from before. It happened because Xcode was not resolving to the Framework Search Path generated by CocoaPods because of values previously set in target's settings.
Solution that helped me:
copy the old path
hit delete to completely clear the Framework Search Path settings in the target's column - the path, generated by CocoaPods would appear there
add the old search path back under the generated one (only needed if you still have some manually added frameworks to work with)
Clean project, wipe Derived Data, build.
The result would look like this (1st line added by Xcode, 2nd added by CocoaPods, and 3rd is manual):
In case of multiple targets.
For eg. Target1, Target2
use_frameworks!
target 'Target1' do
pod 'Fabric'
pod 'Crashlytics'
target 'Target2' do
end
end
Then run pod install.
I tried all of these suggestions but nothing worked for me. Instead what'd worked for me was deintegrating pods. Afterwards deleting the pods folder from xcode hierarchy and doing pod install. Suddenly it worked. Don't ask me why because anyways most of these suggestions are hit or miss anyways but I'll be happy if it works for someone else too :)
Make sure to import correct framework name that is defined in .podspec of the pod.
I usually remove Pods folder and .xcworkspace file, then I run pod installagain and it helps in almost 100% cases.
My setup
macOS 10.14 Mojave
Xcode 10.3
cocoapods 1.7.5
None of the answers work for me, although some gave partial clues. In my case, the root cause was that I customized my build product paths after running pod install.
If you run cocoapods right after creating an Xcode project, then it usually works if you open the generated Xcode .xcworkspace instead of the .xcodeproj.
Funny things happen if you start tweaking your build product paths after generating the workspace. Because the generated Pods project and its target all refer to your old Xcode project settings.
In my case, my trouble came from:
I prefer all my build products sitting under the project folder $(SRCROOT)/build/$(CONFIGURATION)/$(EFFECTIVE_PLATORM_NAME). So I went ahead and changed my Pre-configuration Build Products Path to it .... AFTER doing pod install.
Now, the generated Pods project, including all its Framework target, still points to the old location, so both the header import and linking of your own project will fail (you'd see Command PhaseScriptExecution failed with a nonzero exit code when No such module is fixed).
The fix:
Delete all Pods stuff including the workspace.
Regenerate Pods project and workspace with pod install. However, cocoapods hardcodes the build product path to ${SRCROOT}/../build and Pre-configuration Build Products to $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) in my case, which usually points to a temporary ~/Library/Developer subfolder . Still not quite right. Then ....
Make sure the Framework Search Path and Header Search Path of my own project cover the above paths.
Tweak Pods project setting and all dependency Framework's Pre-configuration Build Products Path to use my preferred paths.
The moral lesson: Always regenerate Pods and verify the key result paths whenever you touch paths in Xcode project settings.
UPDATE
With Xcode 11, Apple finally removed the confusing "Pre-configuration Build Products Path". To customize the build product paths, use Locations in Xcode preferences with global relative paths pre-baked.
If you see this warning:
[!] The `Joint [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Joint/Pods-Joint.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Joint [Release]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Joint/Pods-Joint.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
follow the instructions to avoid Module not found issue.
For me, removing the following from my podFile fixed it:
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
clean project
close xcode
open xcode
enjoy
For using Swift in Objective-C, you should import a header file that Xcode generates automatically in compile time (NameOfModule+Swift.h). In this case, you should try import SwifityJSON in you header file like this:
#import "SwiftyJSON-Swift.h"
I am implementing FB Login so i Downloaded the SDK from https://developers.facebook.com/docs/ios.
then i drag n down FBSDKCoreKit, FBSDKLoginKit and FBSDKShareKit frameworks into my project.
when i ran project it works fine. but when i closed and reopen it, then "FBSDKCoreKit/FBSDKCoreKit.h not found error" appears. then again i copy paste FBSDKCoreKit framework into my project's library
and error disappear and this process continues. anyone faced this problem before?
what should i do to solve this error?
Make sure to follow this step:
Deselect Copy items into destination group's folder.
https://developers.facebook.com/docs/ios/getting-started/
Also, in your Build Settings, look at this field: "Framework Search Paths"
You should have something like this:
/Users/[username]/Documents/FacebookSDK
or for a more general config
~/Documents/FacebookSDK
Also, look at Finder and make sure that the framework is actually there
After updating Cocoapods 1.0.0, I deleted pod.lock and installed the current stable pod versions (4.7.0 to 4.11.0) of FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit
Then i encounter the same error. What i did was:
Added Header Search Paths Build Settings in Xcode:
"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\"
"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\"
"${PODS_ROOT}/Headers/Public/FBSDKCoreKit\"
"${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"
Then i still had error for another file. Because XCode is using prebuild frameworks.
FBSDKCoreKit/FBSDKCopying.h not found
Clean Build -> ⇧⌘K (Shift + Command + K) - to clean builded frameworks.
Clean Build Folder -> ⌥⇧⌘K (Option+Shift+Command+K)
Close Xcode // important! - Otherwise it recreate the DerivedData for the current open project automatically
Run this command in terminal
rm -rf ~/Library/Developer/Xcode/DerivedData
Open XCode and build successfully
I got to solve 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. I know it's not what Facebook recommends, but I couldn't make it work doing that, but this way 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 :)
This also took me hours of pain! Finally I found the root problem.
The Facebook SDK MUST be located at ~/Documents/FacebookSDK
This is because in the RCTFBSDK project this path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDK project (it will be shown in the error console)!
FB developers say don't select copy files. Which creates problem. But I did opposite.
I selected copy items if needed. It copied Frameworks in my project. Also automatically Search Path was added by xcode 7.2.
Also double check if there is nothing in Framework Search Pathsunder Search Paths under Build Settings fields, then just add $(PROJECT_DIR) which is equal to /Users/user/Documents/....PROJECT..DIR...
Compiled in 2 projects successfully.
I had to move FacebookSDK path in Framework Search Paths above $(PROJECT_DIR)
$(SRCROOT)/../../../Documents/FacebookSDK
$(inherited)
$(PROJECT_DIR)
Xcode 11 + CocoaPods solution
In root of your project, i.e. the same path where you have MyApp.xcworkspace open Terminal and init pod's pod init, then add the required FBSDK pods - your Podfile should look something like that:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
end
Now in your Terminal pod install and open MyApp.xcworkspace (which is not MyApp.xcodeproj). Go to MyApp -> Build Phases -> Link Binary with Libraries and you should see at the bottom of the list of frameworks Pods_MyApp.framework. If you'd click + below Pods_MyApp.framework you should in new window below Workspace a list of Pods where all related to FBSDK should be.
Note: Make sure you're installing FBSDK, not Facebook SDK, because the second one is outdated.
If any of the above answers didn't work, try this:
Open your ~/Documents/FacebookSDK folder.
Check if there is this cloud icon right of the filenames:
If so, macOS removed your files from your computer and uploaded them to iCloud! (thanks Apple)
You can:
Click on all the cloud icons, it will download the files back
Disable Storage Optimization on your mac to prevent it from happening again
For React Native devs:
Recommended steps to be done :
1.Make sure that the Facebook SDK frameworks are installed in ~/Documents/FacebookSDK.
2)Make sure that FBSDK[Core, Login, Share]Kit.framework show up in
the Link Binary with Libraries section of your build target's Build
Phases.
3)Make sure Framework Search Path of your
build target's Build Settings is
$(HOME)/Documents/FacebookSDK
instead of
~/Documents/FacebookSDK
If it still doesn't work for you then:
1)sudo chmod -R 755 ~/Documents/FacebookSDK
2) set the path of framework search path of RCTFBSDK.xcodeproj to
$(HOME)/Documents/FacebookSDK
(under libraries of your project folder )
set RCTFBSDK framework searchpath as here
clean your project (command+ shift + k ) and build.
Solution to the problem if your FacebookSDK is different than
~/Documents/FacebookSDK
Because you don't want iCloud Drive to load up with FacebookSDK;
you have to change the "Framework Search Paths" for the added
react-native-fbsdk
This is because in the RCTFBSDK.xcodeproj inside Libraires; path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDK project.
Select the Project
Libraries
Select "RCTFBSDK.xcodeproj"
Build Settings
Add your custom path in "Framework Search Paths"
eg: /Users/rajanmaharjan/FacebookSDK
Clean Build -> ⇧⌘K (Shift + Command + K) - to clean build frameworks.
Build the project; it should build successfully.
I had the same problem. I fixed it by using quotes around my framework search path value i.e. "/Users/.....". Obviously, I have some spaces in my file paths.
I have the same issue.I use Facebook SDK version 4.10.0.I known my solution is not good but worked for me. I changed the Facebook source code.
Changed the import file path from #import <FBSDKCoreKit/FBSDKCoreKit+Internal.h> to #import <FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h>
Using CocoaPods, the only thing that worked for me was:
Update Header Search Paths ( NOT Framework Search Paths ) under Build Settings in Xcode:
- "\"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\"",
- "\"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\"",
+ "\"${PODS_ROOT}/Headers/Public/FBSDKCoreKit\"",
+ "\"${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"",
Add the missing header(s?):
cd Pods/Headers/Public/FBSDKCoreKit/FBSDKCoreKit/ && ln -s ../../../../FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h FBSDKCoreKit+Internal.h
Edit: point 2. needs apparently to be repeated after each following call to pod install.
For Xcode 7.3, the below worked for me.
Follow the steps mentioned on FB's guide and additionally do the below:
step 1. go to Document/FacebookSDK folder
step 2. Click FBSDKCoreKit.framework
step 3. In this folder Remove Modules folder and then drag and drop in your Xcode Project.
References : https://stackoverflow.com/a/29532202
Thanks
For people moving from Carthage to Cocoapods make sure to remove the Carthage references of the FBSDKCoreKit from the Link Binary With Libraries under Build Phases option.
I had a similar issue, and could not resolve the compiler error anyway.
I followed and performed the exact integration steps a few times, until I noticed that I have a copy of the FBSDKCoreKit.framework inside my project folder (happened probably by a mistake). In addition the Framework Search Paths already contains $(PROJECT_DIR) besides /Users/{username}/Documents/FacebookSDK.
So I've removed the copy of the FBSDKCoreKit.framework from the project's directory and now everything works fine.
I ran into this issue last night, and wanted to post my solution just in case someone else has the same problem. My problem was my app was building and running fine in the sim and on my device, however the build would fail because of FBSDKCoreKit whenever I tried to run my unit tests. It took my about 30 minutes to find the problem, and I felt like a dummy when I did.
Make sure that the FBSDKCoreKit bundle is targeted for your tests as well, and not just your regular application build.
I had this problem when upgrading to Xcode 8 and was able to solve it by changing
#import <FBSDKCoreKit / FBSDKCoreKit.h>
to
#import <FBSDKCoreKit/FBSDKCoreKit.h>
When you add the directory to your Build Settings -> "Framework Search Paths", make sure you add it to both Debug AND Release.
Silly error but if you're new to iOS dev in xcode you could miss this.
Personally I had trouble with spaces in various paths, including app name. Removing spaces (or adding "" everywhere to secure paths) solved the problem.
I had similar issue. Fix consisted for me in selecting: "COPY FILES IF NECESSARY" when manually adding the different frameworks into XCode framework.
I dragged the framework to the Framework folder inside xcode, chose to copy files if needed and all worked fine without any other configuration change.
I have installed react-native-fbsdk and link using react-native-link react-native-fbsdk.
Follow instruction of following link
https://developers.facebook.com/docs/react-native/configure-ios
This provide to link react-native library using ios_setup.js There are following step which i have followed.
Setup on facebook developer account.
Install the file ios_setup.js by executing the following command in
a command prompt at your project's root folder.
curl -O https://raw.githubusercontent.com/facebook/react-native-fbsdk/master/bin/ios_setup.js
Install the plist package, the xcode package, and the adm-zip package, by executing the following command.
npm install plist xcode adm-zip
Run the script ios_setup.js by executing the following command, and insert your app's App ID and App Name. If the name of your app is more than one word long, then enclose it between quotation marks.
node ios_setup.js [App ID] [App Name]
When run node ios_setup.js it wll automatically link all files in ios.
After troubleshooting using several answers here. This is what I did.
I changed ~/Documents/FacebookSDK to "$(HOME)/Documents/FacebookSDK" note: I used quotes "
I moved "$(HOME)/Documents/FacebookSDK" to the top of the list in header search paths.
Had a same error in FBSDKLoginKit
If you use multiple pod projects
install! 'cocoapods',
:generate_multiple_pod_projects => true
Then you should force cocoapods to put all of FBSDK pods into a same project to make private headers visible
pod 'FBSDKCoreKit', '5.11.0', :project_name => 'FBSDK'
pod 'Bolts', '1.9.0', :project_name => 'FBSDK'
pod 'FBSDKShareKit', '5.11.0', :project_name => 'FBSDK'
pod 'FBSDKLoginKit', '5.11.0', :project_name => 'FBSDK'
Xcode with Facebook and iOS working - Step By Step
After much frustration I got my Iphone game building just fine. Following a combination of Ixgee's solution, and other solutions.
Fixes - FBSDKCoreKit.h not found and other related issues
I'm using Unity and Facebook SDK v11
Unity -> ExternalDependencyManager -> IOS Resolver Settings - make it build to a Xcode project and make sure all the checkboxes are checked.
MacOS -> move project to Mac. In Terminal in the project directory do the ‘sudo chmod +x process_symbols.sh’
2.5 Make sure you have cocoa pods installed. In Terminal type ‘sudo gem install cocoapods’
MacOS->Podfile - the pod file in your project should look like this for Facebook SDK 11
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
target 'UnityFramework' do
pod 'FBSDKCoreKit', '~> 11.1.0', :modular_headers => true
pod 'FBSDKCoreKit_Basics', '~> 11.1.0'
pod 'FBSDKGamingServicesKit', '~> 11.1.0'
pod 'FBSDKLoginKit', '~> 11.1.0'
pod 'FBSDKShareKit', '~> 11.1.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static
use_frameworks!
[Only needs to be done once. If your Mac processor uses an ARM processor (like the M1)]] Terminal -> Type ‘sudo arch -x86_64 gem install ffi’
Solution from - https://github.com/CocoaPods/CocoaPods/issues/10723 [super helpful!]
[If your Mac processor uses an ARM processor (like the M1)] Terminal -> ‘arch -x86_64 pod install’
Or
[If your Mac processor uses an x86 processor (like an Intel)] Terminal -> ‘pod install’
Once the Pod Install is successful, double click the newly created ‘Unity-iPhone.xcworkspace’ in your project directory to open the workspace in Xcode.
Xcode->The folder option -> Unity-IPhone-> under Projects select ‘UnityFramework’-> select ‘Build Phases’ then drag the ‘> Headers’ above the ‘> Compile Sources’
-Full details here (https://forum.unity.com/threads/xcode-version-13-3-13e113-error-cycle-in-dependencies.1268720/)
Xcode -> In the Unity-phone - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: YES
In the UnityFramework - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: NO
Source - Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks'
VOILA! It builds to your iPhone with Facebook SDK Dependencies good to go on iOS!!!
->Builds Configuration.
-> Framework Search paths.
put the FacebookSDK directory in my case
~/Documents/FacebookSDK in :
Debugging,
Any architecture I Any Sdk,
Release.
especially this error because there no path in Any architecture I Any Sdk
in my case
~ / Documents / FacebookSDK
and it should be noted that the FacebookSDK folder must be in Domuments
Example
https://photos.app.goo.gl/5bD4d39a11AalYsx1
Change the /Users/[username]/Documents/FacebookSDK/ directory to Documents/FacebookSDK like so: