cocoapods pod file dependency issue with Firebase, specifically FirebaseUI - cocoapods

I am trying to use the Firebase Storage documented example code :
// Reference to an image file in Firebase Storage
let reference = storageRef.child("images/stars.jpg")
// UIImageView in your ViewController
let imageView: UIImageView = self.imageView
// Placeholder image
let placeholderImage = UIImage(named: "placeholder.jpg")
// Load the image using SDWebImage
imageView.sd_setImage(with: reference, placeholderImage: placeholderImage)
adapted like so in my app:
func setImage(_ picid: Int32){
let imagesRefs = Constants.FirebaseConfig.storageRef.child("images/thumbs/\(getuid())/thumb_\(picid).jpg");
let placeholderImage = UIImage(named: "placeholder.jpg")
profilePicIV.sd_setImage(with: imagesRefs, placeholderImage: placeholderImage)
}
but the method sd_setImage was not found by xcode so I thought I had to update my podfile with the pod 'FirebaseUI/Storage' but after tinkering with my podfile I get this error:
pod update
Update all pods
Updating local specs repositories
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master fetch origin --progress
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 18 (delta 12), reused 7 (delta 4), pack-reused 0
From https://github.com/CocoaPods/Specs
24df16553de..7cae8225fce master -> origin/master
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master reset --hard origin/master
HEAD is now at 7cae8225fce [Add] MixedRealityKit 0.1.6
Analyzing dependencies
[!] Unable to satisfy the following requirements:
- `TwitterCore (~> 2.8.0)` required by `Podfile`
- `TwitterCore (>= 3.0.0)` required by `TwitterKit (3.0.0)`
- `FirebaseUI` required by `Podfile`
Specs satisfying the `FirebaseUI` dependency were found, but they required a higher minimum deployment target.
My pods file is like so though I have tried other pod combinations but to the same or worse effect:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
target 'StrengthStandards' do
#Pods for StrengthStandards
pod 'Firebase'
pod 'Firebase/Core'
#pod 'Firebase/Auth'
#pod 'FirebaseUI/Google'
#pod 'Firebase/Crash'
#pod 'Firebase/RemoteConfig'
pod 'FirebaseUI'
pod 'Firebase/Database'
#pod 'FirebaseUI/Database'
#pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
What am I doing wrong? Also my xcode gives the error No such module 'FirebaseAuthUI' on my import FirebaseAuthUI line.
Before this problem I had my Firebase Database and Firebase Auth working.
I am using Xcode 8.3.3 and Swift 3, on MacOS 10.12.6
Thanks
PS: making some progress - now my podfile is:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
target 'StrengthStandards' do
use_frameworks!
#Pods for StrengthStandards
#pod 'Firebase'
pod 'Firebase/Core'
#pod 'Firebase/Auth'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Google'
#pod 'FirebaseUI/Google'
#pod 'Firebase/Crash'
#pod 'Firebase/RemoteConfig'
#pod 'FirebaseUI'
pod 'Firebase/Database'
#pod 'FirebaseUI/Database'
#pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
and I no longer get the dependancy issues however, xcode now tells me that the method call
profilePicIV.sd_setImage(with: imagesRefs, placeholderImage: placeholderImage)
is wrong:
/Users/myname/Dev/IOSDev/StrengthStandards/StrengthStandards/Settings.swift:325:40: Cannot convert value of type 'StorageReference' to expected argument type 'URL?'

Seems to work now though I admit I'm not sure if it is exactly the way it is supposed to be done. For anyone interested here is what I have so far:
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
target 'StrengthStandards' do
use_frameworks!
pod 'Firebase/Core'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Google'
pod 'Firebase/Database'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
pod 'SDWebImage/Core'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
and here is my function:
import SDWebImage
func setImage(_ picid: Int32){
let imagesRefs = Constants.FirebaseConfig.storageRef.child("images/thumbs/\(Constants.getUID())/thumb_\(picid).jpg");
imagesRefs.downloadURL { url, error in
if let error = error {
// Handle any errors
print("Error getting url for profile pic: \(error)")
} else {
// Get the download URL for 'images/stars.jpg'
let placeholderImage = UIImage(named: "placeholder.jpg")
self.profilePicIV.sd_setImage(with: url, placeholderImage: placeholderImage)
}
}
}

Related

"No such module 'Firebase'" // framework not found FirebaseUI

I previously had Firebase connected to my app with the below pods (excluding pod 'Firebase/DynamicLinks) and it was working just fine. I was using the line 'import Firebase' at the top of each view controller to import the relevant frameworks.
However, today I went to add pod 'Firebase/DynamicLinks' and when I went to run pod install, it got stuck 'analyzing dependencies'. I read through other forums on stackoverflow to fix this issue. I ended up removing cocoapods from my project and reinstalling them. I now have reinstalled the pods, but when I open Xcode I get the message 'No such module 'Firebase'. It essentially wants me to import specific Firebase modules [import FirebaseDatabase, import FirebaseAnalytics, etc.] instead of just [import Firebase]. After updating the import on all of my view controllers, there is 1 issue remaining -> 'Framework not found FirebaseUI'.
Questions
Is going from 'import Firebase' to 'import FirebaseDatabase, etc.' recommended or is this a step backwards?
How can I resolve 'Framework not found FirebaseUI'? I have the pod installed already.
Other info that may help
When running pod install, I get a warning notification: [!] [Xcodeproj] Generated duplicate UUIDs
When trying to build project, I also get: ld: warning: directory not found for option '-F/Users/[myNameHere]/Library/Developer/Xcode/DerivedData/[AppName]-dtipemvgjzrgzvephbatansalrwu/Build/Products/Debug-iphonesimulator/Firebase'
As well as: ld: warning: directory not found for option '-F/Users/[myNameHere]/Library/Developer/Xcode/DerivedData/[AppName]-dtipemvgjzrgzvephbatansalrwu/Build/Products/Debug-iphonesimulator/FirebaseUI'
My podfile
pod 'FirebaseUI'
pod 'FirebaseUI/Auth'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
pod 'Firebase/Analytics'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'FirebaseUI/Google'
pod 'FirebaseUI/Facebook'
pod 'Firebase/DynamicLinks' (new)
After rereading the Firebase documentation, it turns out "You no longer need to add the iOS pod Firebase/Core. This SDK included the Firebase SDK for Google Analytics."
I ended up removing Core and the UI Cocoapods (using my own UI buttons instead) and the project now builds. I assume there may be an error installing the UI Framework with the FirebaseUI Cocoapod - idk.
Pods removed:
- pod 'Firebase/Core'
- pod 'FirebaseUI'
- pod 'FirebaseUI/Auth'
- pod 'FirebaseUI/Google'
- pod 'FirebaseUI/Facebook'

Getting 401 Unauthorized error when installing a pod

I'm setting up a new pod in my pod file and when I do pod install I have an error what should I doing ?
I tried this line to add the pod in my podfile :
pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token='
this the error
[!] Failed to fetch podspec for MapboxVisionNativeAll at https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=<sk.eyJ1IjoiYnJhaGltY2hlYmJpIiwiYSI6ImNqdXlhMXl6aDBmeXo0M3BpYjV6MnFib3IifQ.VinI6ER1YN2nDxXRJzaFXw>.
Error: 401 Unauthorized
=> I guess, You are misplacing your .netrc.
=> The .netrc file should be in your home directory (~ on the command line, or use Go ‣ Home in Finder).
In terminal type: cd ~
touch .netrc
open .netrc
paste below to .netrc with SecretKey
machine api.mapbox.com
login mapbox
password <INSERT SecretKey>
Enjoy: pod install will work without error
Following is my working Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.2'
use_frameworks!
target 'PROJECT_NAME' do
pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=sk.eyJ1IjoiZWRkeXZlcmJydWdnZW4iLCJhIjoiY2p1c3F5eGVpMDA1eTRlbzJpOXJwdDIxMCJ9.OZRITqde9clot1E8Za_OsQ'
end
This error occurs if the token is invalid.
I tried accessing the link from the error and it says that the token is invalid.

Syntax error in Cocoapods podfile

When I run the "pod install" command in the Terminal, I get this error message:
[!] Invalid `Podfile` file: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('.
# from /Users/pdenlinger/Desktop/Clima-master/Podfile:1
# -------------------------------------------
> Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
# -------------------------------------------
Here are the contents of the podfile, which I edited with Xcode:
Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Clima' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Clima
pod 'SwiftyJSON'
pod 'Alamofire'
pod 'SVProgressHUD'
end
Comment the first line:
#Uncomment the next line to define a global platform for your project
Not a great error message ...

SQLite.swift unknown type name 'NS_ASSUME_NONNULL_BEGIN'

I'm using SQLite.swift. There's an error "Unknown type name 'NS_ASSUME_NONNULL_BEGIN'" when I build the project.
What I do:
create a demo project 'SqlDemo'
under SqlDemo/, create Podfile
use_frameworks!
source 'http://git.oschina.net/akuandev/Specs.git'
pod 'SQLite.swift', git:'https://github.com/stephencelis/SQLite.swift.git'
# pod 'SQLite.swift/Cipher', git: ... # instead, for SQLCipher support
~
then 'pod install'
after that open SqlDemo.xcworkspace
build the project
this maybe a pretty simple error. I'm new to ios dev.

Cocoapods error

From my Podfile: why does this work:
pod 'RestKit', :git => 'git#github.com:EATechnologies/RestKit.git', :commit => '56401aaa5b3714bbde5d2852f92c0b29e392b460'
but this does not:
pod 'RestKit', :git => 'git#github.com:EATechnologies/RestKit.git', :commit => '0831f2dc2da01731d37795a2c3bd8acb4045dda9'
When I use the latter, I get an error that looks like this:
$pod update
Updating spec repo `master'
-> Pre-downloading: 'MCSMKeychainItem'
-> Pre-downloading: 'RestKit'
[!] Failed: /usr/bin/git rev-list --max-count=1 0831f2dc2da01731d37795a2c3bd8acb4045dda9
[!] Failed: /usr/bin/git rev-list --max-count=1 0831f2dc2da01731d37795a2c3bd8acb4045dda9
[!] Cache unable to find git reference `0831f2dc2da01731d37795a2c3bd8acb4045dda9' for `git#github.com:EATechnologies/RestKit.git'.
This seems to have been fixed with Cocoapods 0.15.1.
1 - first install git (command line tool for mac)
link to download is : http://git-scm.com/download/mac
2 - then open commind line (or terminal) and type
$ sudo gem install cocoapods (you need to wait here , be patient)
3 - now you can shoot the command "pod --version" to check the version of the pod you just installed.
4 - shoot again pod search libpusher (just an example of a library, you can type any library name here instead of 'libpusher' ).
5- let it be complete , it may take some time.
6- then most imp step , create the pod file , (name can be 'podfile') in your project directory and add it to your project in Xcode.
7 - Now Here the secret is : you need to provide the path to this pod file too here , so type command:
cd /Rakesh/vidyo_demo/vidyo_phonegap/ios (eg.)
after cd command rest is the path of the pod file directory.
8- and now when you will type 'pod install ' command in terminal.
and all libraries (which are written in podfile) will get installed on your project path. just then open the project which now has a workspace file. like demo.xcworkspace (open it)
9- here is the format of pod file:
platform :ios, '7.0'
pod 'libPusher', '~> 1.4'

Resources