Swift: How to integrate a library? - swift

I like to integrate a zip library in my macOS application.
I created a file named Podfile in my project folder (next to .xcodeproj file).
It contains following lines (as given here - on the bottom of the page):
source 'https://github.com/CocoaPods/Specs.git'
pod 'Zip', '~> 0.4'
If I run $ pod install on the terminal, I am receiving this error:
Analyzing dependencies
[!] The dependency `Zip (~> 0.4)` is not used in any concrete target.
EDIT:
I tried it now with the pod init template, but got an error. So I raised a new question.

It's a very simple question, and it does mean that you didn't give your research on what you are searching for. Please do your research, and then post a question here if there is any problem. Please give respect to people's time.
GitHub repo SSZipArchive
CocoaPods
pod install SSZipArchive
Carthage
github "ZipArchive/ZipArchive"

Related

FirebaseCore.h file not generating in project using CocoaPods

I recently installed CocoaPods and Firebase into my project. I've been attempting to build but am getting the following errors:
'FirebaseCore/FirebaseCore.h' file not found
Could not build Objective-C module 'Firebase'
Command PhaseScriptExecution failed with a nonzero exit code
I checked my folders and the FirebaseCore.h file definitely does NOT exist. I've reinstalled CocoaPods, modified the Podfile and did a 'pod update' and 'pod install' several times.
I've reviewed several of the questions and solutions listed on stack overflow but none of them have worked.
Here are my specs:
Xcode 11.3.1
Swift 5
My Podfile looks like this:
# platform :ios, '9.0'
target 'project' do
use_frameworks!
# Pods for Project
pod 'MessageKit', '~> 3.0.0-swift5'
pod 'MessageInputBar'
# Add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
# Add the pods for any other Firebase products you want to use in your app
# For example, to use Firebase Authentication and Cloud Firestore
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
end
That's the error you'll get when opening the project using the .xcodeproj file.
You need to use the .xcworkspace file to open the project.
That file is generated when installing the pods using cocoapods.
Other things to try
Quit XCode. Go into terminal and do this sudo gem install cocoapods. Then use the cocoapods.app to update the project with your pod file. Then clean and rebuild the project.
In your project, select the project name in the left column (where the project files are). Then in Targets, ensure the Team popup is selected to your team name, not 'None' and that your Signing Certificate is correct.
This one is extreme but I have seen it correct some build issues. Deleting the login keychain (using the keychain.app). This will also delete all of your stored passwords so keep that in mind.
Even I had same issue when upgrading to Xcode 11.2.1. Errors were resolved after using Firebase 6.13.0.
Please make changes to your Podfile as below,
pod 'Firebase', '=6.13.0'
pod 'Firebase/Core'
pod 'Firebase/Analytics'
Somehow my base project had other issues that were generating this error that I was never able to uncover. So I did the following:
1. Created a new project and imported old project files.
2. Installed cocoapods on the new project
3. Followed the FireBase instructions referenced in the answer from #Jay
4. Cleaned project and performed a build
5. No more error

Installing Package with CocoaPods

I'm trying to install the Charts package to use with CocoaPods and it keeps saying "No such module 'Charts'".
If I added the pod 'Charts' in the podfile, and did a pod install and the files are there in Xcode, how come it still gives me an error when I try to import Charts?
Do I still need to do the steps below? Or does CocoaPods do it for me?
Drag the Charts.xcodeproj to your project
Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework
My pods file looks like this now:
You just have to hit Command-b to build, then the error will go away. The other solution is to hit Product > Build.
I had a similar problem when I was developing an app for an older platform. The CocoaPod I sourced supported Swift 4 but I was developing for Swift 3. When I sourced the last Swift 3 version of the pod, the "No such module" error was no longer there. Try the following line in your Podfile:
pod 'Charts', '3.0.3'
instead of the latest version.
try installing it manually moving the complete charts folder to your project, or downloading using carthage, it's way more cleaner using carthage than cocoapods because it doesn't create you a .xcworkspace like cocoapods.

Cocoapods: Cannot load module 'Alamofire' as 'Alamofire'

Update: I solved the question. Please see my answer below (underneath the question and comments).
This question was marked as a duplicate, but it's different because it is a brand new error that I couldn't find through any searches.
I tried installing Alamofire into my XCode project.
As per their their tutorial, I installed cocoapods onto my system.
I then navigated to the folder of my existing xcode project in the terminal, and did:
pod init
I then edited the new pod file and added:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'RainyShinyCloudy' do
pod 'Alamofire', '~> 4.4'
end
Finally, I executed the command:
pod install
My terminal told me the install was successful.
But when I opened the .xcworkspace, made a new swift class and tried to import Alamofire, I got this error:
One possible reason could be that I had tried to install an earlier version of alamofire earlier, deleted it and then installed this.
But I really don't know how that could have mattered.
Thanks for any help you guys can give me.
Actually it failed because you were trying to import AlamoFire and not Alamofire. Imports are case sensitive.
Update: I posted an answer earlier that was wrong.
But now I actually figured it out.
I made a new project, went to the settings menu by clicking on the name of my app in the project explorer.
Then I went to Linked frameworks and libraries which is at the very bottom of the General tab.
I pressed that little + icon, selected Alamofire.framework. and set the status to required
Following this, cleaning and rebuilding the project made the error go away.

SQLite.swift and SQLiteCipher.swift Anyone successfully using?

Is anyone successfully using SQLiteCipher.swift?
SQLite.swift installs and works with cocoapods.
https://github.com/stephencelis/SQLiteCipher.swift suggests cocoapods install:
use_frameworks!
pod 'SQLiteCipher.swift',
git: 'https://github.com/stephencelis/SQLiteCipher.swift.git'
and this results in:
[!] Unable to find a specification for 'SQLiteCipher.swift'.
The doco then suggests manual install:
Drag the SQLiteCipher.xcodeproj file into your own project. (Submodule or clone the project first.)
In your target’s General tab, click the + button under Linked Frameworks and Libraries.
Select the appropriate SQLiteCipher.framework for your platform.
Click Add.
This results in No such module SQLiteCipher.
I've tried every "no such module" fix on the internet ... nada
Any insight appreciated! Thanks in advance
Looks like 'readme' file is outdated.
I ran into the same issue and here is solution (it worked for me, but according to discussion it's not perfect):
pod 'SQLiteCipher.swift',
git: 'https://github.com/stephencelis/SQLite.swift.git',
branch: 'swift-2'
https://github.com/stephencelis/SQLite.swift/issues/196

Cocoa pods GLM Error

So today I've been trying to try out a new project using Swift, but I've arrived to an abrupt halt. I've been trying to run the VideoCore sample project found here: https://github.com/jgh-/VideoCore/tree/823ec7cac50e5a0b4457bd06dd95a50dca88d9c0/sample/SampleBroadcaster-Swift.
So during the initial setup I had to navigate to the directory and run pod install. pod install executed without any errors, and say I need to close Xcode, and reopen the new workspace, which I did. When I try to go and run the app for debugging (as according to the documentation I can run it right after pod install'ing, I get an error that says 'type_half.inl' file not found. A few screenshots are here to better explain/show: http://d.pr/i/14TqW, and http://d.pr/i/1aYSi.
I've tried reinstalling the pod multiple times, and I haven't been able to resolve this issue. Has anyone had a situation like this, or have any idea on how to get out of this blackhole?
Thanks!
This has been resolved by downgrading CocoaPods to version 0.38.2. Here's what I did:
gem install cocoapods -v 0.38.2
gem uninstall cocoapods -v 0.39.0
And that fixed my issues.
Instead of downgrading CocoaPods to version 0.38.2. This error can be resolved in other way as I have fixed recently on of my project.
STEP 1:- Search Header Search Paths under build setting on GLM target or target that uses GLM pod like in my project VideoCore cocoapods uses GLM
STEP 2:- make it recursive instead of non-recursive.
Build again error will be fixed.
NOTE:- if you update cocoapods that you have to redo the steps again. Also target will be in pod project.
Attached image for reference.