No such module 'Alamofire' in Xcode 10 - ios

I got the project folder from iOS developer.
I try to 'Archive' this to the app store, but there is an error.
the error is "No Such Module 'Alamofire' ~ "
I've looked at a lot of Stack Overflows.
I think my project has a different directory.
iOS developer can't even ask what the problem is because they haven't been contacted. Who can see what's wrong?
Many of the answers say "podfile," but there is no file named podfile in my project directory, but instead in the pods folder.Only xccconfig files exist.
The project folder structure is
= APPLICATION
== APPLICATION
== APPLICATION Tests
== Pods
and
in pods Folder has two file
( Pods-APPLICATION.debug.xcconfig ),
( Pods-APPLICATION.release.xcconfig )
The content is as follows:
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '#executable_path/Frameworks' '#loader_path/Frameworks'
OTHER_LDFLAGS = $(inherited) -framework "Alamofire"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

it's possible that the project you got doesn't include the Alamofire pod.
open terminal go to the directory of the Project and open the pods w\
open Podfile -a Xcode
check if the Alamofire pod is in the file, if not write the following
pod 'Alamofire'
save the file and write
pod install
in the terminal
if the Alamofire is already in the pod file then type
pod update
in the terminal, and that should solve your problem.
in case your Project doesn't have a Podfile use
pod init
that will create a Podfile in your project directory.

Related

Build error with bit code enabled; ld: -bundle and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together

I have a pod project, containing an example that demonstrates the usage of the pod. The bitcode enabled setting is set to yes, both on the example and Pod targets. The following is the Podfile of the example:
use_frameworks!
platform :ios, '10.0'
target 'MyPod_Example' do
pod 'MyPod', :path => '../'
target 'MyPod_Tests' do
inherit! :search_paths
end
end
The example app runs well on the Simulator, but while trying to run it on an iPhone 6S, I get the following build error:
ld: -bundle and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang: error: linker command failed with exit code 1 (use -v to see invocation).
How do I fix this?
Another project that I have that has the same pod, but downloads the pod from its repo works fine on iPhone, with bitcode enabled. The following shows the Podfile structure of the app that works:
source '<my pod spec repo>'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'MyPodTest' do
use_frameworks!
# Pods for MyPodTest
pod 'MyPod'
target 'MyPodTestTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyPodTestUITests' do
inherit! :search_paths
# Pods for testing
end
end
The -bitcode_bundle flag being passed to ld is described in the error message ("Xcode setting ENABLE_BITCODE=YES"), but the -bundle flag is not, which can make this confusing and hard to debug.
If you look at the lines preceding this error, you will likely see two important ones:
WriteAuxiliaryFile /Users/YOURUSER/Library/Developer/Xcode/DerivedData/YOURPROJECT-xxxxx/Build/Intermediates.noindex/YOURPROJECT.build/Release-SDK/TARGET.build/DerivedSources/TARGET_vers.c (in target 'TARGET' from project 'YOURPROJECT')
CompileC /Users/YOURUSER/Library/Developer/Xcode/DerivedData/YOURPROJECT-xxxxx/Build/Intermediates.noindex/YOURPROJECT.build/Release-SD/TARGET.build/Objects-normal/arm64/TARGET_vers.o /Users/YOURUSER/Library/Developer/Xcode/DerivedData/YOURPROJECT-xxxxx/Build/Intermediates.noindex/YOURPROJECT.build/Release-SDK/TARGET.build/DerivedSources/TARGET_vers.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'TARGET' from project 'YOURPROJECT')
These two lines are the real meat of your problem. Your bundle, which formerly had no binary files in it (only PNGs, XIBs, and other resources), now has a binary file. One that was created by Xcode. Because this binary was created as part of a resource bundle target, it's compiled as a CFBundleExecutable using the -bundle flag, which is incompatible with ENABLE_BITCODE. Instead of disabling bitcode, though, you should prevent this binary from being generated in the first place.
This binary is being created by Apple Generic Versioning. To get rid of it, go to your build settings tab (on your resource bundle target), click the "all" button to see all settings, then search for "versioning system". Change this from "Apple Generic" to "None". Resource bundles do not properly support versioning.

CocoaPods: use static lib into a pod

I have a pod that depends on a static lib (precompiled, source code not available).
In this pod project, i drag and drop the folder containing the ".a" file and some other C, Obj-c files.
When i try to include this pod in an application, Cocoapods copy all that pod files but not the ".a" file.
In the Podspec, im using this to include the precompiled library to my pod
s.ios.vendored_frameworks = 'path/a_staticLib.a'
The line above copy the file in frameworks (Pods folder), this is normal as it is called "vendored_frameworks", but i can't found any solution to work with static library.
the error i have :
ld: framework not found -framework
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thank you.
As said in CocoaPods Podspec documentation, you need to use vendored_libraries for static libraries.
So this line:
s.ios.vendored_frameworks = 'path/a_staticLib.a'
should be:
s.ios.vendored_libraries = 'path/a_staticLib.a'

ld: library not found for -lCocoaLumberjack

I updated pods for SalesforceSDKCore 4.3.1 and SalesforceRESTApi 4.3.1. When I did pod install it in turn installed cocoaLumberjack library which is a dependent library I suppose. After successful install of Pods, I couldn't build successfully, as I am getting this error -
ld: library not found for -lCocoaLumberjack
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I deleted my Library search paths, added/deleted inerited in Other linker Flags, nothing seem to work. These are my search path and other linker flag settings.
My Pod file -
# platform :ios, '8.0'
target 'Custom' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Custom
source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
pod 'SalesforceSDKCore'
pod 'XMLDictionary', '~> 1.4'
pod 'SalesforceNetwork'
pod 'SmartStore'
pod 'SmartSync'
end
I had the same problem. I tried many solutions, some of them are:
File/Workspace Settings/Derived Data Arrow -> Delete DerivedData folder, empty trash
Terminal -> pod deintegrate , pod install
If you renamed your target's name, then:
Target/Build Settings/Test Host :: $(BUILT_PRODUCTS_DIR)/TargetName.app/TargetName
I really hate this linker command failed problem. I get it all the time and every time I need to follow another solution to solve this. I must have given over 30 hours of my life to this s#$t.

use_frameworks! Cocoapods, can't find header file for non-cocoapods framework

I am using Cocoapods in my project, but I also want to use frameworks that are not managed by Cocoapods. I recently tried to switch to frameworks using the use_frameworks! command in my podfile, but the result is that the build fails because it can't find a header from my third-party framework. In the xcconfig file for my project, I have FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/vendor, which worked in the past (vendor being where the .framework file is stored).
I don't know much about this topic; my attempt at solving this was to add a HEADER_SEARCH_PATHS setting to the xcconfig file with the same settings as the FRAMEWORK_SEARCH_PATHS, which did not solve the problem. Any help would be appreciated.
EDIT: upon further investigation into the problem I think I better understand what is causing this behavior, though I'm no closer to a resolution. The Xcconfig configuration I'm using is set up approximately like this for the debug scheme:
Pods-ProjectName.debug.xcconfig -- the CocoaPods created xcconfig file for the project. Contents are roughly as follows:
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '#executable_path/Frameworks' '#loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/x.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/y.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/z.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/a.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "x" -framework "y" -framework "z" -framework "a"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-ProjectName
PODS_ROOT = ${SRCROOT}/Pods
ProjectName.xcconfig - contents are as follows:
APPLICATION_EXTENSION_API_ONLY = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/vendor
WARNING_CFLAGS = $(inherited) -include "$(SOURCE_ROOT)/ProjectName/ProjectNameVersion.h"
INFOPLIST_FILE = ProjectName/Info.plist
PRODUCT_NAME = ProjectName
SKIP_INSTALL = YES
ProjectNameDebug.xcconfig - includes both of the prior xcconfig files, is the project's xcconfig file. In case it matters, here's the contents:
#include "ProjectName.xcconfig"
<h1>include "../Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig"
The thing is, what I'm actually seeing when I open the xcporoject file and go to Build Settings->Framework Search Paths is bulid/Debug-iphoneos/Pods-ProjectName. So somehow my vendor search path is getting overwritten.
Apologies for the formatting, SO didn't want to highlight this stuff as code, and in some cases even tried to make it bold...

CocoaPods generates invalid project file (header not found)

I have a project file with a Podfile that looks like this:
platform :ios, '7.0'
def import_pods
pod 'Specta', '0.1.8'
pod 'Expecta', '0.2.1'
pod 'RestKit', '0.20.3'
pod 'MagicalRecord', '2.1'
pod 'RestKit/Testing', '0.20.3'
end
link_with 'LocalMedTests'
import_pods
When I run pod install, it generates the Podfile.lock, Pods directory, and workspace for my project. When I open the workspace to build it, I get errors like this: 'RestKit.h' file not found.
It seems to only be an issue for RestKit but I can't get past those errors to see if there are more. The restkit headers are in Pods/Headers. They're properly included in Pods.xcconfig. Here it is for good measure:
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/Expecta" "${PODS_ROOT}/Headers/MagicalRecord" "${PODS_ROOT}/Headers/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit/CoreData" "${PODS_ROOT}/Headers/RestKit/RestKit/Network" "${PODS_ROOT}/Headers/RestKit/RestKit/ObjectMapping" "${PODS_ROOT}/Headers/RestKit/RestKit/Support" "${PODS_ROOT}/Headers/RestKit/RestKit/Testing" "${PODS_ROOT}/Headers/SOCKit" "${PODS_ROOT}/Headers/Specta" "${PODS_ROOT}/Headers/TransitionKit"
OTHER_LDFLAGS = -ObjC -framework CFNetwork -framework CoreData -framework Foundation -framework MobileCoreServices -framework Security -framework SenTestingKit -framework SystemConfiguration
PODS_ROOT = ${SRCROOT}/Pods
I've tried cleaning and cleaning the build folder. It doesn't matter - I always get the header not found error.
I should also add that all of the header directories specified by Pods.xcconfig are included in the target as they should be.
Any ideas about this? I've been using CocoaPods in this project for a couple of months with no issue, did something change recently?
This solved my Problem
In HEADER_SEARCH_PATHS Under your Project Build Setting add the $(inherited)
Also DO this for all TAGETS
Change Arcgitectures to Standard armv7
https://stackoverflow.com/a/12142790/1294448
For me, the problem was with Other Linker Flags and Runpath Search Paths, which weren't inheriting the settings defined on xcconfig. The following adjustments solved my problem:
Other Linker Flags:
$(inherited)
Runpath Search Paths:
$(inherited)
#executable_path/Frameworks

Resources