Why do I need to 'import 'framework'? - ios

I'm working on a personal project and I've installed Firebase with Cocoapods and imported it in the bridging-header.
My question is why do I get an error if I try to use a Firebase method in my project if I haven't written import Firebase at the top? The same can be said for Google Analytics etc.
The reason I ask is because in this tutorial: Ray Wenderlich Firebase Tutorial
Firebase is configured the same way as mine - but none of the documents contain import Firebase, and the project recognizes any Firebase method universally without errors.
I know I can just use import but I don't understand what I am doing differently and would rather not have to.

I think u have in pod file line:
use_frameworks!
delete it and reinstall pods it should help

In the mentioned project, the import is done from the Grocr-Bridging-Header.h, it's actually an Objective-C import:
#import <Firebase/Firebase.h>
The reason why the import was done from Objective-C is beause the project is quite old and Cocoapods didn't have support for Swift then.

Related

Firebase Integration Sample for iOS (FriendlyPix)

I’m using Googles sample app, running from their workspace file, to see how specifically Firebase Authentication works. I downloaded their sample project, installed the CocoaPods via terminal, and have ran Pod Update to ensure everything is up to date.
When I compile everything goes smooth until the very end with a single compiler crash for “No Such Module” for “import FirebaseAuthUI”.
I can post the code when I get home, and feel there may be something wrong with the header search path in build settings, have tried adding $(SCROOT) and continues to have an issue finding the frameworks.
I’ve scoured the net and have seen other issues finding Firebase pods just like this, just wondering what could be wrong. Here is a link to the project, I have not modified this project at all. Just wanted to see it work.
https://github.com/firebase/friendlypix-ios
FirebaseAuthUI & FirebaseGoogleAuthUI are now part of FirebaseUI.
So you should replace all the import FirebaseAuthUI & import FirebaseGoogleAuthUI with import FirebaseUI
You will be ready to go.

Xcode/Swift: How to import a framework without actually including 'import xxx' in file

I've been following a Firebase tutorial for Swift here.
In the project I don't see any explicit 'import FirebaseXXX' within any of the files and was curious how this was being done.
I'm trying to get the same behavior in project but haven't had much luck yet. I have the same Bridging Header in my project, I've tried building/cleaning my project, and I've done 'pod update' and 'pod install' after adding the different pods to my Podfile.
So how exactly is this being done?
Thanks!
If you look at the bridging header (Grocr-Bridging-Header.h), they import the framework there
#import <Firebase/Firebase.h>
Objective-C #imports that happen in the bridging header are global across swift files in the project.
If you are using the swift framework, you'll need to import Firebase at the top of the files to use the framework.
Also see Cannot import Firebase in Swift app

GoogleMaps not found

I am trying to use google maps in my ios app my Xcode ver is 7.2 and swift ver is 2.1.1. I simply add GoogleMaps in my pod file everything is fine i added frameworks and libs which are required to support Googlemaps all fine, i am following this tut and according to this i have to add a bridging header file to include
#import <GoogleMaps/GoogleMaps.h>. My app already have one bridging header file because i am using facebook login as well so i put the import statement in the same file and in 'others linker flag -ObjC' is already there so after few required settings in storyboard i compiled my proj but i am getting this error "GoogleMaps/GoogleMaps.h" not found. I have searched for it and tried almost all the suggested ways on Stackoverflow but hard luck nothing worked yet.I will be really grateful if anyone could suggest me what i am doing wrong here.
Make sure your pod install went smoothly.
According to the tutorial,
You should see output similar to the following:
Downloading dependencies
Installing GoogleMaps (1.10.4)
Using SwiftyJSON (2.3.0)
Generating Pods project
Integrating client project
try
#import "GoogleMaps.h"
in your bridging header file

Parse and Facebook SDK imports conflict in Xcode 6 ("ParseFacebookUtils" is not recognized)

When I try to import the ParseFacebookUtils framework in Swift, it does not work. In the documentation https://parse.com/docs/ios/guide#users-facebook-sdk-and-parse I follow the steps to integrate the FBSDK (once I have Parse up and running, error-free).
The thing is that since the Parse.com iOS SDK was just recently updated (you dont really have to create bridging headers anymore for the Parse SDK Frameworks), and in the link above they tell you to include:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
in your header file. I tried both to import the ParseFacebookUtils with a regular import in swift, but the compiler complains and says:
(This is my AppDelegate.swift file)
Then I tried my luck and went ahead and import everything normally as in the image above, but then creating a bridging header just to import ParseFacebookUtils, like so:
But it did not work. Even if I comment out the ParseFacebookUtils in swift.
Can you help me solving this issue?
Thank you so much for your help in advance!
Cheers!
In my AppDelegate, I didn't have to import ParseFacebookUtils, just UIKit, Parse, FBSDKCoreKit, and FBSDKLoginKit (I also added Bolts to be safe but it didn't make a difference). My bridging header also includes "#import " Have you tried deleting the other PFFacebookUtils Framework that isn't V4? My Parse frameworks came with PFFacebookUtils.Framework and PFFacebookUtilsV4.Framework and deleting the older one got rid of my compiling errors, although my app still has its own login issue at runtime that you hopefully won't have. Hope that solves your problem!
Because Armin's answer didn't work for me, what I have done is the following:
I created a bridge file (to be able to import Objective - C code in Swift).
I removed the ParseFacebookUtils.framework. (I don't know if it is necessary).
I wrote the following: #import <ParseFacebookUtilsV4/PFFacebookUtils.h>.
After that I was able to use PFFacebookUtils!
Try change to
import ParseFacebookUtilsV4
and remove reference ParseFacebookUtils Because is not working with Parse sdk 4+

Xcode 6 Playground using Parse framework?

I would like to use Parse SDK/Framework my playground file but I get an error if I import it. I can import the iOS frameworks like UIKit
I know there are similar posts to this (How to I import 3rd party frameworks into Xcode Playground?)
but i could not make it work for my project.
Any help here is very very much appreciated... I am not a complete newbie but am not an expert So as many details (almost for dummies ;-)) as you can please...Many thanks.
To get Parse working in playground you will need to create an Xcode project and include the Parse framework. Then within that project you can add a playground and import frameworks and code written in that project. Hope this helps.
If you are curious I did it for a framework I created and created a Playground inside the projects workspace. In that I import Dollar which is a custom framework but I guess you could import Parse and it should work https://github.com/ankurp/Dollar.swift

Resources