Install 'JSONWebToken' library without cocoapods - ios

Is there a way to install this library without cocoapods ? because when i install it with pod i get this 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:
CryptoSwift and JSONWebToken
And when i add 'use_framewords!' i got error on the other libraries written with objective-c that use pod also
Here is my podfile :
source “https://github.com/CocoaPods/Specs.git”
platform :ios, '8.1'
pod 'GoogleMaps'
pod 'RSKImageCropper'
pod 'AFNetworking', '~> 3.0'
pod 'DZNEmptyDataSet'
pod 'Instabug'
Thank's in advance

You can drag and drop the
link
sources into your project. If you add the library in this way, you
will update the library manually as you know.
The second option is using cocoapods and solving the problem. When you use use_frameworks! cocoapods tries to convert the whole pods as framework, so the error should be in your bridging header. Try to import your frameworks in your files.

Related

Tons of issues with Alamofire when compiling xcode project

I was running my program softly and at some point (maybe closed the Xcode to reopen or updated pod file) it suddenly it can't compile anymore.
I already tried opening .xcodeproj and .xcworkspace. The first one shows this message when compiling:
The second case shows tons of issues:
This is my pod file:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'HonoluluArt' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# Pods for HonoluluArt
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'GoogleMaps'
pod 'GooglePlaces'
end
Can I get any help? Thanks a lot!
try to clear pods and reinstall:
in the project folder execute: pod deintegrate
then clean pods: pod clean
Reinstall pods: pod install
this should work
also if you don't need in particular the v3 of Alamofire remove ~> 3 to install the latest version and modify your Podfile:
target 'HonoluluArt' do
use_frameworks!
pod 'Alamofire'
pod 'GoogleMaps'
pod 'GooglePlaces'
end
Alamofire ~> 3.0 is written in Swift 3. Podfile shows that this is an older codebase. You could try building you project with older version of Xcode (xCode 10.0 is last version supporting Swift 3) or you should upgrade Alamofire to actual version ~> 5.0 (you will also need to upgrade project codebase to newer Swift version).
You indicated you opened the project file and compiled. Cocoa Pod instructions clearly state after installing, you should only work in the .xcworkspace file thereafter. Can you open that and try a compile?
I just removed any reference to Alamofire. Pod file, imports, paths and stuff and it worked. I'm trying to manage the code once it is removed, but worked.
Thanks anyway!

Transitive dependencies that include static binaries using google map and clustering

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

adding 'use_frameworks!' in podfile is breaking app

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.

SimpleAuth pod not installing properly

I use several pods in my Xcode project, all work perfectly well except SimpleAuth
Here is my code in my podfile:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, ‘8.0’
pod 'SWRevealViewController', '~> 2.3'
pod 'SAMCache'
source 'https://github.com/calebd/SimpleAuth'
use_frameworks!
pod 'SimpleAuth/Instagram'
Then, I install my pod using my terminal targeting my project folder. And as you can see, the "SimpleAuth" folder created in my project is empty when it should include all the objective-c classes that it needs to operate:
Any help by more experience objective-c coders much appreciated.
why are you using two ways. instead use simple
podflie
use_frameworks!
platform :ios, ‘8.0’
pod 'SWRevealViewController', '~> 2.3'
pod 'SAMCache'
pod 'SimpleAuth/Instagram'
there is no need of mentioning source path. Cocoapods will do it automatically.
It is not used because if sometime in future if it change then you will have a problem.

Unable to use both Swift and Obj-C libs with Cocoapods

I have just started a new Swift project and I would like to use different libraries. In particular, I would like to use Realm.io, an Obj-C library. But, I would also like to use pure Swift libraries such as Alamofire or Dollar.
I use Cocoapods for managing my dependencies. I use the latest version (0.37.0) and the new use_frameworks! flag. pod install is successful anytime.
Unfortunately, when I try to build my project I get two errors (for my main target):
Umbrella header Realm.h not found from module.modulemap
Could not build Objective-C module Realm from any file using import Realm
Other imports work fine.
I have noticed the following: if I remove pure Swift libs and use_frameworks, everything works fine. I am aware about this current issue from Cocoapods. However, it should not be a problem for Realm asks developers to use that flag.
Here is my Podfile:
platform :ios, '8.0'
use_frameworks!
target 'rothrock' do
pod 'Realm'
pod 'Cent'
pod 'SwiftyJSON'
pod 'Alamofire'
end
target 'rothrockTests', :exclusive => true do
end
I use no bridging header. Should I?
Any idea or workaround?
Alright, here is the full walkthrough:
Install dependencies using Cocoapods and the use_frameworks! flag.
As you need to use a Objective-C dependency, create a Bridging header. You can create one easily by importing an Objective-C class to your Swift project, than remove it (the wizard should ask you if need a bridging header). Otherwise, create a new header file. Then, navigate to your target configuration and enter the name of your file in Swift Compiler - Code Generation > Objective-C Bridging header.
Still in your target configuration, add a new entry in Search Paths > User Header Search Paths: Pods as value and flag it as recursive.
Remove any import instruction from your code, relative to your Objective-C library.
Build your project. You should have a success.
You need a bridging header and import your Objective-C library headers there.
If you are using only Realm you can check out this documentation for Swift http://realm.io/docs/cocoa/ (go to CocoaPods down in the tabs)
Swift
Install CocoaPods 0.36.0 or later ([sudo] gem install cocoapods).
In your Podfile, add use_frameworks! and pod 'Realm' to your app target.
From the command line, run pod install.
Use the .xcworkspace file generated by CocoaPods to work on your project!
Download the latest release of Realm and extract the zip.
Drag the file at Swift/RLMSupport.swift into the File Navigator of your Xcode project, checking the Copy items if needed checkbox.
I just installed the Realm library in a project I have with some of the libraries you mention above like Alamofire and SwiftyJSON and others and it works fine when you build the project and even put the import Realm, no compilation errors at all.
I'm using Cocoapods 0.36.0, the stable version and this is my PodFile :
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
link_with 'ApiWorkflow', 'ApiWorkflowTests'
pod 'SwiftyJSON', '~> 2.2'
pod 'Alamofire', '~> 1.2'
pod 'Typhoon', '~> 3.0'
pod 'SwiftCSV', '~> 0.1'
pod 'Realm'
I hope this help you

Resources