Trouble running Firebase database quickstart in Swift - ios

I wonder if anyone of you have tried the database quickstart sample provided by Firebase.
https://github.com/firebase/quickstart-ios/tree/master/database
I am able to run the Objective-C part but when I tried to target the Swift part, there is this error message: Firebase module is not available.
I am not too sure what I did wrong and if you have successfully targeted and ran the Swift part, may be you could give me some hints.
The pod file was included in the sample which is as shown below:
# DatabaseExample
use_frameworks!
platform :ios, '7.0'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'FirebaseUI'
target 'DatabaseExample' do
end
target 'DatabaseExampleSwift' do
end
target 'DatabaseExampleTests' do
end

The pod declarations should be inside your target like so:
platform :ios, '7.0'
target 'DatabaseExample' do
use_frameworks!
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'FirebaseUI'
end
target 'DatabaseExampleSwift' do
end
target 'DatabaseExampleTests' do
end

Related

how to share Alamofire in widget

I'm making some weather app. and i want to show weather info on widget too
So i tried to import Alamofire in Widget's ViewController but it couldn't find module
I also check tutorial from other blog or website, but in my project i cannot find Alamofire in `Linked Frameworks and Libraries like this
This is my Podfile
platform :ios, '10.0'
target 'From Yesterday' do
use_frameworks!
pod 'Alamofire'
pod 'SVProgressHUD'
pod "ScalingCarousel"
end
I also edit Pod file like below
platform :ios, '10.0'
use_frameworks!
target 'From Yesterday' do
use_frameworks!
pod 'Alamofire'
pod 'SVProgressHUD'
pod "ScalingCarousel"
end
target 'From Yesterday Widget' do
pod 'Alamofire'
end
but it gaves me some warning not error, I think that means i installed Pods twice so I think this is wrong
How can i use Alamofire correctly in Widget

FireBase SDK for Unity iOS missing FireApp Class

We are trying to integrate FireBase SDK in Unity Project for iOS platform. For testing, we imported FireBaseAnalytic.unitypackage in an empty project, and put GoogleService-Info.plist on Assets folder.
Once we export XCode project from Unity and build in XCode we are getting few errors about missing few classes from:
we also tried to install Cocoapods file and place Podfile in XCode Project. Cocoapod file contains information as below:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Unity-iPhone' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Unity-iPhone
target 'Unity-iPhone Tests' do
inherit! :search_paths
# Pods for testing
pod 'Firebase/AdMob'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Invites'
pod 'Firebase/Messaging'
pod 'Firebase/Performance'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
end
end
even these all changes do not help to build test project even just with Firebase Analytic.

Unable to find a specification for 'Firebase' (IOS Swift)

I am adding cocoa pods to my ios project (swift).
I have initalized the pods in the project directory using 'pod init myproject.xcodeproj'. I then added pod 'Firebase' to the Podfile as such:
project 'HOTS IOS.xcodeproj/'
platform : ios, '9.0'
target 'HOTS IOS' do
use_frameworks!
pod 'Firebase'
target 'HOTS IOSTests' do
inherit! :search_paths
pod 'Firebase'
end
target 'HOTS IOSUITests' do
inherit! :search_paths
pod 'Firebase'
end
end
Now when I run pod install i get the error: Unable to find a specification for 'Firebase'.
Depending on what Firebase service you want to use you have to add different Firebase services in your podfile. "'Firebase'" is not a valid pod.
pod 'Firebase/Core' is the most basic and will give you the prerequisite libraries needed to get Firebase running. If you want to use other services you can choose between these pods:
pod 'Firebase/Core' --> Prerequisite libraries and Analytics
pod 'Firebase/AdMob' --> AdMob
pod 'Firebase/Messaging' --> Cloud Messaging / Notifications
pod 'Firebase/Database' --> Realtime Database
pod 'Firebase/Invites' --> Invites
pod 'Firebase/DynamicLinks' --> Dynamic Links
pod 'Firebase/Crash' --> Crash Reporting
pod 'Firebase/RemoteConfig' --> Remote Config
pod 'Firebase/Auth' --> Authentication
pod 'Firebase/Storage' --> Storage
(Note: without --> text. Only add for example pod 'Firebase/Database')
Here is the documentation for setting up iOS:
https://firebase.google.com/docs/ios/setup

No such a module 'Firebase' in Tests.swift file after Converting to swift 3

After I converted the project to swift 3 I'm getting this error in Test.swift file:
No such module 'Firebase'
Command/usr/bin/ditto failed with code 1
is that mean I have to update the firebase framework? Why that happened?
*The application still runs though!
*Here's the pod file:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
use_frameworks!
target 'TheTestingApp' do
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
end
The issue is you are using the mentioned Cocoapods for TheTestingApp only you also need to add these or the Cocoapods you wanna use for the TheTestingAppTest
Also Clean your project : - CMD+SHIFT+K, Then run pod install & then run your app.
Something like this:-
use_frameworks!
target 'TheTestingApp' do
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
end
target 'TheTestingAppTests' do
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
end
I've been using Firebase in my personal project and I was able to do my Unit Test but tonight I encountered this annoying error in my new project. While Dravidian's answer is correct, it is a bit incomplete and code is redundant. I wrote a blog about this: http://www.prettyitgirl.com/2017/07/how-to-fix-missing-required-module-in.html and to summarize, here are the steps on how I solved this problem :)
Make sure that all your dependencies are targeting Swift 3.0 version and add your test target under your main target, like so:
target 'ProjectName' do
pod 'Firebase/Auth'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
pod 'Firebase/Storage'
target 'ProjectNameTests' do
inherit! :search_paths
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
end
Add a search path in your Header Search Paths
In your Tests target’s Build Settings, search for Header Search Paths and add these two new search paths:
$(SRCROOT)/Pods (recursive)
${PODS_ROOT}/Firebase/Core/Sources (non-recursive)
EZ! :)
Adding ${SRCROOT}/Pods/Firebase/CoreOnly/Sources on my Unit Test Target's HEADER_SEARCH_PATHS or Header Search Paths fixed it for me.
To add it to the Header Search Paths:
Go to the Unit Test Target
Click Build Settings tab
Search Header Search Paths
Double click to trigger input view
Paste ${SRCROOT}/Pods/Firebase/CoreOnly/Sources
Clean and build it again and it should be good to go
Ref: https://github.com/firebase/firebase-ios-sdk/issues/16#issuecomment-449701843
you check your podfile its already in declare at that time your project has been clean (ctrl+shift+k) Otherwise podfile data erase and again podfile install its should better work..

how can I install Firebase authentication in terminal using cocoa pods?

When I enter pod 'Firebase/Auth' it isn't installing the pod. Its saying this: [!] Unable to satisfy the following requirements:
Firebase/Auth required by Podfile
None of your spec sources contain a spec satisfying the dependency: Firebase/Auth.
You have either:
out-of-date source repos which you can update with pod repo update.
mistyped the name or version.
not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.
[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
I have said in the pod file - pod 'Firebase' and that is installing fine, but I don't know why 'Firebase/Auth' isn't installing.
This is using swift and Xcode is any of you were wondering, please can someone suggest what I can do to solve this, thanks
This is the pod file:
platform: ios, '8.0'
use_frameworks!
target: 'Lifelapse' do
pod 'Canvas'
pod 'Firebase'
pod 'Firebase/Auth'
end
EDIT:
The solution was just to 'pod repo update' which worked perfectly. However now I have 27 error messages - Please help!
I did more or less than the guy told us
but my steps were a little different:
On the Terminal: go to your project folder:
1.1 sudo Desktop/YourApp
1.2 YOURMAC:YourApp Fernanda$ sudo pod init
Change your file Podfile to:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'YourApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for YourApp
pod 'Firebase'
end
On the Terminal: pod install
Now, change your file Podfile again to:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'YourApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for YourApp
pod 'Firebase'
pod 'Firebase/Auth'
end
On the Terminal: pod update
try update platform version 8.0 to 9.0
platform: ios, '9.0'
use_frameworks!
target: 'Lifelapse' do
pod 'Canvas'
pod 'Firebase'
pod 'Firebase/Auth'
end

Resources