Trying my hand at building a cocoapod and I need to include the SwiftKeyChainWrapper cocoapod as a dependency. I have the pod linked inside the .podSpec file but (1) I can't find a way to include it in the development pod whilst I build it to use methods and (2) when I run pod lib lint --verbose --no-clean --use-libraries I get the following error:
ERROR | [iOS] unknown: Encountered an unknown error (Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pods being used are: SwiftKeychainWrapper
Inside the pod project I have the following:
platform :ios, '11.0'
use_frameworks!
target 'MyPod_Example' do
pod 'MyPod', :path => '../'
target 'MyPod_Tests' do
inherit! :search_paths
end
end
And the dependency is listed:
s.dependency 'SwiftKeychainWrapper'
Thanks
--use-libraries is the flag to use static libraries instead of dynamic frameworks, you should remove it from your lint command to make it work as a framework.
Related
In updating to the latest Cocoapods, I updated googleapis pod and encountering the following error on Archiving the build in Xcode 11.1:
Multiple commands produce '...iphoneos/gRPCCertificates.bundle'
1) Target 'gRPC-gRPCCertificates
2) Target 'gRPC-C++-gRPCCertificates
How do I remove the Build target gRPC-C++ certificates? Looking in Build Settings and can't seem to find anything here.
Here is my Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '13.0'
target 'Kintsugi Mindful Wellness' do
use_frameworks!
# Pods for Kintsugi Mindful Wellness
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Database'
pod 'Firebase/Crash'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
pod 'Firebase/Performance'
pod 'Firebase/Functions'
pod 'Firebase/Messaging'
pod 'googleapis', :path=> "."
pod 'GoogleSignIn'
...
target 'Kintsugi Mindful WellnessTests' do
inherit! :search_paths
end
target 'Kintsugi Mindful WellnessUITests' do
inherit! :search_paths
end
end
Older thread mentions updating to the latest pod (https://github.com/firebase/firebase-ios-sdk/issues/2102) but I've already done so and keep encountering this issue (happens every OS update but keep forgetting where to change this config).
When I use the Legacy Build System, I get more granular errors as follows:
Lexical or Preprocessor Issue
Include of non-modular header inside framework module 'GRPCClient': '.../Build/Intermediates.noindex/ArchiveIntermediates/.../gRPC-umbrella.h
While building module 'ProtoRPC' imported from /...google/cloud/speech/v1/CloudSpeech.pbrpc.h:6
While building module 'GRPCClient' imported from /.../Intermediates.noindex/ArchiveIntermediates/.../BuildProducts...
In file included from <module-includes>:1:
Parse issue
Could not build module 'GRPCClient'
ProtoRPC.h
While building module 'ProtoRPC' imported from /.../CloudSpeech.pbrpc.h:6:
In file included from <module-includes>:1:
In file included from /.../gRPC-ProtoRPC/gRPC-ProtoRPC-umbrella.h:14:
Could not build module 'ProtoRPC'
CloudSpeech.pbrpc.h
In file included from /.../v1/CloudSpeech.pbrpc.m:2
The duplicate gRPC certificate bundle can be found in Products.
To remove the duplicate bundle, select Pods and from the Target, just remove one of the certificates (e.g. gRPC-C++-gRPCCertificates):
I am trying to use the GooglePlaces iOS API; however, every time I follow the directions for installing it via CocoaPods, I always get a Linker Command error. I've tried the steps about a million times and always get that error after building. Furthermore, I am using the workspace file that documentation recommends and I believe that I have followed all of the steps correctly. Can someone please help me?
Xcode version: 8.3.2 (8E2002)
Pod File Content:
source 'https://github.com/CocoaPods/Specs.git'
target 'MoodSwings' do
pod 'GooglePlaces'
end
Xcode Error:
ld: framework not found GoogleMapsBase
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks!
First I Deintegrate Cocoapods from your project using this link Deintegrating and Removing Cocoapods from your project after that using pod init I create pod file again this is the podfile updated content
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MoodSwings' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MoodSwings
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
target 'MoodSwingsTests' do
inherit! :search_paths
end
target 'MoodSwingsUITests' do
inherit! :search_paths
# Pods for testing
end
end
After that I remove all configurations in Build Setting -> Framework Search Path and your project finally works!!
here is the repo Github repo
My Pod file looks like this
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'GoogleMaps'
pod 'Alamofire', '~> 4.0’
pod 'SDWebImage', '~>3.8'
pod 'Applozic', '~>3.8'
pod 'Google-Maps-iOS-Utils'
end
When i install pod with all this framework Stated it gives me This error
[!] The 'Pods-MyApp' target has transitive dependencies that include static binaries: (/Users/Mad/Downloads/MyApp/Pods/GoogleMaps/Frameworks/GoogleMaps.framework)
Please help me.
I'm not saying that the answers above are wrong, but I recently cd'ed into the project instead of the project-folder which resulted in the same output.
You have to download the Utils repository locally and then import to your xcode project. A step by step guide can be found here: Integrating with Swift projects which use 'use_frameworks!' in the Podfile
I'm trying to include Alamofire in my Swift project following the github(https://github.com/Alamofire/Alamofire#cocoapods) instruction.
I've created a new project, navigated to the project directory and run this command sudo gem install cocoapods. Then I faced following error:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
After searching I managed to install cocoapods by running this command sudo gem install -n /usr/local/bin cocoapods
Now I generate a pod file by pod init and edited it this way:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Law
pod 'Alamofire'
target 'ProjectNameTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
Finally I run pod install to install Alamofire. After that I open the project and import Alamofire statement gives me following error No such module 'Alamofire'
Update-1: Results of pod install is:
Analyzing dependencies
Downloading dependencies
Using Alamofire (3.4.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Open the .xcworkspace not the .xcodeproj
go to Product -> Scheme -> Manage Schemes...
and check Alamofire true
this work for me
Sometimes with no reason xcode can't load a module Alamofire. It can happen after a work session, after opening a project. The fix for this is to select a schema -> Alamofire, and run. If the message is "Successful", the schema can be changed back to project and it will work with no problems.
I suggest you to change your pod file like this below:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'Alamofire', '~> 3.0' <<<---- Alamofire library is cross beetween projects
target 'NotifyM' do
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
Another thing is use_frameworks! you should use this if the project is Objective-C based and try to use Swift pod library.
UPDATE: for the new cocoapods version 1.x the shared library should be like this:
# There are no targets called "Shows" in any Xcode projects
abstract_target 'Shows' do
pod 'ShowsKit'
pod 'Fabric'
# Has its own copy of ShowsKit + ShowWebAuth
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# Has its own copy of ShowsKit + ShowTVAuth
target 'ShowsTV' do
pod 'ShowTVAuth'
end
end
as indicated into cocoapods website :http://guides.cocoapods.org/using/the-podfile.html
you have to clean project and build, before you can import that library.
Install this way Pod file
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'NotifyM' do
pod 'Alamofire', '~> 3.0'
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
I suggest that and it's work for me :
platform :ios, '8.0'
use_frameworks!
target 'App' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'
end
After that, run : pod install in your project repository
2021 M1 USERS
according to: https://developer.apple.com/forums/thread/123614?answerId=683594022#683594022
close XCode
open Finder app and show there "Applications"
right click on icon Xcode and click on "Get info" (or something similar)
there is checkbox "Open with Rosseta" (or something similar). Select it
run Xcode again and try to build
it worked for me hope it works for you.
After a lot of efforts and all solutions provided above. I have fixed on Xcode 13.0:
Use for Simulator:
Go to:
- Build settings -> EXCLUDED_ARCHS = arm64
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64 x86_64
Use for Realm Device:
Go to:
- Build settings -> EXCLUDED_ARCHS =
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64
You should tap the Target to select Alamofire and build it once before coding.
When using Cocoapods to include dependencies always open your .xcworkspace
In Podfile use use_frameworks!
Remove any linked libraries from build phases.
In Build Setting look for Framework Search Path and add $(inherited) in both debug and release.
Do the same for Header Search Path too.
Now try a clean build.
My iOS app contains both objective-C and Swift code. Now i have added use_frameworks! at the top of pod file to use some swift library. Unfortunately it started giving compilation errors.
My pod version : 0.39.0
It started complaining about imports in bridge.h file
Pod file contains objective-C libraries. Now i want to add swift libraries.
How can i fix this issue. Let me know if needs more details
use_frameworks!
platform :ios, '9.0'
xcodeproj 'Test.xcodeproj'
def devDependecies
pod 'SocketRocket'
pod 'CocoaLumberjack'
pod 'MRProgress'
pod 'GRMustache', '~> 7.3.0'
pod 'Realm', '=0.96.2'
pod 'ADALiOS'
pod 'Office365/Outlook'
pod 'Office365/Discovery'
pod 'AFNetworking'
#https://github.com/youtube/youtube-ios-player-helper/issues/160
pod 'youtube-ios-player-helper', :git=>'https://github.com/youtube/youtube-ios-player-helper', :commit=>'head'
pod 'iOSCalendarEventParser', '=0.0.4'
pod 'OneDriveSDK'
end
target 'Test' do
devDependecies
end
Sample error in bridge.h file :
But this file exists under pod directory.
'youtube-ios-player-helper' can compile as a framework.
So remove it from the bridge header and just add an import line in your Swift classes
import youtube-ios-player-helper
Do the same for all pods that can compile as a framework
At this moment Xcode does not allow that. use_frameworks works only with swift pods or libraries. If you add an objective C library you need to use the bridging header, therefore you need to remove the use_frameworks instruction in order to make it work. The only work around I found is to only import through pods the objective C libraries and the swift libraries you can add them manually. You can copy the classes names and content and use them as if you would have created them.