cannot build objective-c module 'FBSDKCoreKit' - swift

Cant import FBSDKLoginKit to my Project (i am using cocoapods with swift)
Solution tried:
remove use_framework! from podfile
added $(PODS_ROOT) path to user header search paths
try to import in Bridging Header file (FBSDKCoreKit.h,FBSDKLoginKit.h,FBSDKShareKit.h)
Showing Error:
My Podfile:

You should also add the FBSDKCoreKit.Framework from Facebook.
Adding only the FBSDKLoginKit will give you this error.

Go through the below steps and your problem will be solved:
Tap on "Pods.xcodeproj" in your project
Select all the pods / any of one in which you are facing the issue.
Tap on "Build Settings" and change "Build Active Architecture Only" to "NO"
Now try to build to build the project and your problem will be solved.
Hope this helps!

Related

"Missing Package Product" error in Xcode when adding a new package

After adding a package (Kingfisher) to my Xcode project, I noticed the following error when building:
I am not sure why I am getting this error, because from what I can tell the package was added correctly. I've verified that in the Targets > Frameworks section I see the package Kingfisher listed:
I've also verified that in the Project > Package Dependencies section, I see the package listed:
Furthermore, I even tried to just remove the dependency on this package altogether by removing it from both the Targets > Frameworks section using the "-" button, and I did so as well in the Project > Package Dependencies section. However even after removing it from both of these places I still get the same error when trying to build, which was very surprising.
I'm new to xcode so any help/tips would be appreciated
The problem might as well be in some cached data that still dwell in DerivedData. Try deleting DerivedData for your project and then reinstantiate package again. Also clean build folder with Cmd + Shift + K You can open your DerivedData folder in finder window directly through Xcode by navigating to: Xcode -> Preferences -> Location and clicking on the small arrow next to DerivedData directory.

XCFramework "Cannot load underlying module"

I've built an SDK as an XCFramework, which shares dependencies with the app that uses it. When I build, I'm getting:
...SDK.swiftmodule/arm64-apple-ios.swiftinterface:20:8: Cannot load underlying module for...
This occurs in the Compile Swift Sources action and the break is in the import MySharedDepedency statement in the swiftinterface file
As stated, the SDK in the project as an xcframework bundle. MySharedDependency is fulfilled with cocoapods. use_modular_headers is set in the Podfile, it's modulemap is included in the linker flags (by cocoapods).
Its DOES work if I use the use_frameworks! flag in the Podfile but only with dynamic linkage and for internal politics reasons, I need this to work with static linkage. If I add the :linkage => :static argument, I get the same error as with no use_frameworks! call
I've tried changing the order of the linked frameworks in Build Phases (so that the pods are linked before the SDK framework). I've tried adding recursive header/framework/module search paths everywhere I can find a MyDependency.modulemap...
Yes, I've cleaned caches, deintegrated, clean installed, erased deriveddata, restarted xcode, my machine, ...
Argh! Thanks for any help...
I had the same exactly the same scenario and the same problem
I solved using #_implementationOnly in every file from my xcframework's code like:
#_implementationOnly import Alamofire
After that just rebuild your XCFramework, clean and build your app's project.
It works like a charm without use_frameworks!

Xcode error: Missing required module 'Firebase'

The problem:
I have a dynamic framework, which uses Firebase added by cocoapods. And I also have the App, which uses this dynamic framework. But when I try to build the project I got error Missing required module Firebase.
I tried the following:
remove derived data + clean
re-install pods
add 'Import paths' to the build settings (in this case I got error 'Library not loaded' in runtime)
My podfile:
target 'Project' do
...
end
target 'Framework' do
pod 'Firebase/Core'
pod 'Firebase/Auth'
end
The Framework is added to Embedded binaries and Linked Frameworks and Libraries.
For anyone still having this issue, doing this solved it for me.
Add this to your test target build settings.
HEADER_SEARCH_PATHS = "${SRCROOT}/Pods/Firebase/CoreOnly/Sources"
Full discussion can be found on firebase GitHub issues.
you can find HEADER_SEARCH_PATHS in Test Target > Build Settings > Search Paths > Header Search paths.
Just incase you cant find HEADER_SEARCH_PATHS in Build Settings, click the ALL button to show all settings.
Add the following to your test target:
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Firebase/CoreOnly/Sources"
That’s in test target > Build Settings > Header Search Paths.
After adding test target, running:
pod install
and add to:
HEADER_SEARCH_PATHS = $(inherited)
fixed for me.
On Framework Search Path pod put all pod projects path automatically.
Of course, to podfile added this after last pod name:
target 'TestTargetName' do
inherit! :search_paths
end
Nothing did help to me until
target 'TestTargetName' do
pod 'Firebase/Storage'
end
I'm not sure what firebase does so I can't run tests (tests do not depend on firebase at all)

Why I cant import the library that in swift file after installing the the dependency in Cocoapods?

I already install this library, XLPagerTabStrip via Cocoapod. My pod file is look like this,and already hit pod install in terminal.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyProject
pod 'XLPagerTabStrip', '~> 8.0'
end
So everything is completed install,but when I want to import the library in Swift file,it giving an error ->> No such module 'XLPagerTabSript'.
I read a lot of question about this,which mention add the file path of the library to
Build Setting -> Search Paths -> User Header Search Paths. I also already did,but still giving the same error.
What I add in User Header Search Path is something like this:
${SRCROOT}/Users/Myname/Desktop/MyProject/Pods/XLPagerTabStrip
After adding the file path,I clean the project,build the project again,the tried to add in import XLPagerTabStrip to one of my swift file,the error still the same.
Can somebody let me know what is problem actually? Cause I beginner in Ios development,I totally no idea what I doing wrong.
I end up solve it by update my Xcode vesion and insert the file path of the library in inside
Build Setting -> Search Paths -> Framework Search Paths -> (Add the
file path of the library here)
By this I can import the library in swift file without any warning

What library to import for #import <libxml/HTMLparser.h>

I have imported ASIHTTP files into my project and inside ASIWebPageRequest.m there is the following import:
#import <libxml/HTMLparser.h>
which is not recognized. What library should I add in order to be recognized?
Go to the Project build settings (Project->Edit Project Settings->Build) and find the "Search Paths". In "Header Search Paths" add the following path:
$(SDKROOT)/usr/include/libxml2
Note, you may be missing all development headers after upgrading OS X (at least this was the case for me with Mavericks). To reinstall the command line tools run:
xcode-select --install
With xcode 4.5, it doesn't work. I try with
/usr/include/libxml2
and it works well
putting ${SDK_DIR}/usr/include/libxml2 for the "Header Search Paths" build setting worked for me.
*Info: I'm using xcode 5