I am using Amplify, which I installed through cocoapods and it works fine in my "regular" iOS application in Swift.
I have now created a Widget Extension, inside of which I would also like to use Amplify.
I have tried adding Widget.swift to the main app's target, but that didn't let me compile because now there were two #main structs. (For the app & for the widget)
Is there a way to import Amplify and use it in WidgetKit?
Edit your Podfile to apply Pod for all targets: application & widget. Ex:
def workspace_pods
pod 'YourPod'
end
target 'YourApplication' do
use_frameworks!
workspace_pods
end
target 'YourWidget' do
use_frameworks!
workspace_pods
end
Related
I recently had put banner and interstitial ads on my application. After which, I decided to incorporate RevenueCat. Once the pod was installed, I had many errors that I could not fix. I decided to remove the CocoaPod. Once that was completed, I had been getting the following problems.
AVFoundation.h – AVFCore/AVFcore.h file not found
RPBroadCastExtension.h. – Could not build module AVFoundation
GameKit.h. – Could not build module ReplayKit
FIRGameCenterAuthProvider.m – Could not build module GameKit
I have been trying for 2-3 days to fix the problem. Here is what I have been doing.
I tried removing all pods and reinstall all the pods.
I try to clean the build. Same error came back.
I tried to add and remove RevenueCat.
I changed build setting to enable module c & Objective C. I added use_modular_headers! to Pod file.
my pod file
target 'FetalGrowthPercentile' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
use_modular_headers!
# Pods for FetalGrowthPercentile
pod 'Firebase/Firestore'
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Auth'
end
None of which helps. I am lost. Please advise!!
Louis
I use Swift Frameworks (Cocoa Touch Framework) to segment code into fairly independent modules.I have imported several external libraries, with Cocoapods, into the main app and those modules without any issues so far.
Xcode 9.3
iOS 11.2
CocoaPods 1.5
GoogleToolboxForMac (2.1.3), Firebase (4.13.0), FirebaseAnalytics (4.2.0), FirebaseCore (4.0.20), FirebaseDatabase (4.1.5), FirebaseInstanceID (2.0.10)
However when I import Firebase in any of those modules, in addition to importing it in the main app, my application crashes.
I don't even need to use anything from Firebase in the modules ; simply adding the pod to the target (module Store in this case) in the Podfile will crash the app as soon as I leave the main window (fira_viewDidDisappear).
There is also a long list of issues during startup (that were also reported by others), all similar to :
objc[36264]: Class FIRAIdentifiers is implemented in both /{$userdir}/Library/Developer/Xcode/DerivedData/FrameWork101-aekmajbumgzabmayoanlcrwtzbcs/Build/Products/Debug-iphonesimulator/Store.framework/Store (0x105478318) and /{$userdir}/Library/Developer/CoreSimulator/Devices/31D920E9-CD46-47C4-9631-503B3471AAF7/data/Containers/Bundle/Application/57B8020D-E2AB-4A06-B654-5F26F8E00AF6/FrameWork101.app/FrameWork101 (0x103b1ef80). One of the two will be used. Which one is undefined.
Pretty ominous statement...
There are several threads somewhat related to this :
How do I Integrate the Firebase cocoaPods in my custom swift framework?
Building a swift Cocoa Touch framework with Firebase as a dependency
And even an issue (#6619) filed...
But they don't have a clear resolution / answer and the issue has even been closed without any resolution.
So is there a way to use Firebase in a modular approach (using frameworks) ? If so what's the best way to make this works ? Or is the Firebase SDK too invasive to do so ?
Thanks !
Podfile :
project 'FrameWork101.xcodeproj'
platform :ios, '11.2'
target 'Binding' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
end
target 'Model' do
use_frameworks!
target 'ModelTests' do
inherit! :search_paths
end
end
target 'Service' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
end
target 'View' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
end
target 'Store' do
use_frameworks!
pod 'ReactiveKit'
pod 'Bond'
pod 'Firebase/Database' <---- comment this out and it works fine.
end
target 'FrameWork101' do
use_frameworks!
pod 'Firebase/Core'
pod 'ReactiveKit'
pod 'Bond'
target 'FrameWork101Tests' do
inherit! :search_paths
end
end
And part of the crash report :
When I'm trying to integrate an apollo server to a meteor app I get errors as soon as I try to open graphiql. If I create an express app and connect it with webapp.connectHandlers, and put apollo server to one of that express app's routes, thing work, but they don't work in "meteor way", which I would really like to have, since I would get access to the user object, authorization etc.
Error, which I see in graphiql as soon as it loads:
Error: Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory
stacktrace:
at invariant (/Users/.../node_modules/graphql/jsutils/invariant.js:18:11)<br> at Object.validate (/Users/.../node_modules/graphql/validation/validate.js:59:72)<br> at doRunQuery (/Users/.../node_modules/apollo-server-core/dist/runQuery.js:88:38)<br> at /Users/.../node_modules/apollo-server-core/dist/runQuery.js:22:54<br> at /Users/.../.meteor/packages/promise/.0.10.0.borizy.o9z8++os+web.browser+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
server code:
import {makeExecutableSchema} from 'graphql-tools';
import {typeDefs} from './schema';
import {resolvers} from './resolvers';
import { createApolloServer } from 'meteor/apollo';
export const schema = makeExecutableSchema({
typeDefs,
resolvers
});
createApolloServer({
schema
});
Everything seems legit and works with express, but not with meteor. What is the reason? How can I fix it?
The current version of meteor/apollo is out of date with the latest apollo npm packages. https://github.com/Swydo/ddp-apollo is up-to-date and does the integration in a "meteor way" 😊
Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory
If this is the problem, it would be solved by
rm -rf node_modules/*
npm install
This is what happens:
running on Xcode Version 7.3.1 (7D1014)
pod 'Firebase/Core'
import Firebase in the Class
unresolved on Database
Then I added the Database framework
pod 'Firebase/Core'
pod 'Firebase/Database'
unresolved on FirebaseApp
It seems that the 2 frameworks are in mutex mode. They cannot coexist.
I have tried everything: update, install, uninstall, recreate the project, recreate the workspace. All.
May you help me. Is there a bug on last Firebase release?
I had a similar issue.
Your import statement would be:
import Firebase
Make sure restart Xcode and to clean the build folder.
It's working for me & got rid of "Use of unresolved identifier FirebaseApp..." error
Update: For Swift 4.2: FirebaseApp.configure() does work. [FIRApp is renamed to FirebaseApp]
import FirebaseCore
Then you could use FirebaseApp.configure(). I'm using swift 4.
Sounds like you might be using an older version of Firebase. Try -
pod repo update
pod update
Double check Firebase 4.0 is being installed.
Also try importing the specific modules. So instead of
import Firebase use import FirebaseDatabaseor import FirebaseAuth.
use FIRApp.configure() instead of Firebase.configure()
sudo gem install cocoapods
pod update
Replace pod 'Firebase/Core' with pod 'Firebase'.
Then run pod repo update.
That work today for me:
1. in Xcode 9.1
import UIKit
import Firebase
import UserNotifications
import FirebaseInstanceID
import FirebaseMessaging
import FirebaseCrash
import FirebaseAnalytics
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
2. My PodFile
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Crash'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
pod 'FirebaseUI', '~> 4.0'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
3. finale:
pod repo update
pod update
4. restart xcode:
5. press: shift-alt-command-k (in xcode)
This will delete all of the products and intermediate files in the build folder.It's different from delete derive data.
6. an clean
done
In my case it I needed to import FirebaseCore instead of import Firebase or import FirebaseRemoteConfig.
I put in 'Firebase' along w/ 'Firebase/Core' in the podfile and it worked for me
It worked for me with
pod repo update
pod update
and then run this at the location of the pod file:
pod install
After rebuilding my app the error should be gone.
Use FIRApp.configure() instead of FirebaseApp.
For those facing the issue with RemoteConfig configuration, adding an extra import:
import FirebaseRemoteConfig
helped in my case
import FirebaseCore
Adding this to the top of the class resolved the issue for me.
FirebaseCore version: 6.29.0
This is probably too late but if you are sure your podfile is correct and your app has been building before.
When this error just comes out of the blue, remember that the other thing can go wrong is your Xcode's incremental build folder.
Try this:
Quite Xcode
Locate your Build folder and DerivedData folder in finder
Delete Build folder and DerivedData folder
Rebuild via Xcode
Hopefully you'd be fine then.
There are "create new app" or "import from google project" only in new Firebase console.( https://console.firebase.google.com/ )
How to update exit old app to new one?( https://www.firebase.com/account/#/ )
---Edit
This issue looks like already fixed.
I think the cause is 500 request error on new Firebase console.
However it had fixed already.
If you are already signed in to the new Firebase Console with the same Google account as you used on firebase.com, then you should see your firebase.com project listed under "Projects currently at Firebase.com".
Follow the instructions on the new Firebase upgrade page for Web, Android or iOS.
I've had a somewhat similar problem. I see the import button but when I click it, and select the project I want to load, it only displays the spinner. Ive even tried to import JSON from an old firebase project (before the upgrades) and it just spins. Could it be that the old JSON is not what the new firebase is expecting?
EDIT
OK, seems it doesn't like Chrome. Works in IE 11 but not Chrome 50.0.2
This is how you update a Firebase < 3.0 app to Firebase 3.
Step 1
Install Regular Firebase - pod 'Firebase', '>= 2.5.1'
Or
If considering your old app is already Firebase < 3.0 you should be fine.
Step 2
Update - pod update
*At this point it will take a good couple minutes to update. You should see something like this.
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing Firebase 3.2.0 (was 3.2.0)
Using FirebaseAnalytics (3.2.0)
Installing FirebaseAuth (3.0.2)
Using FirebaseDatabase (3.0.1)
Using FirebaseInstanceID (1.0.6)
Using GoogleInterchangeUtilities (1.2.1)
Installing GoogleNetworkingUtilities (1.2.1)
Using GoogleSymbolUtilities (1.1.1)
Using GoogleUtilities (1.3.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 10
total pods installed.
Step 3
Now you should have Firebase 3. So you can add frameworks like such in your pod file then pod update
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'xMarket' do
end
target 'xMarketTests' do
end
target 'xMarketUITests' do
end
pod 'Firebase', '>= 2.5.1'
pod ‘Firebase/Core’
pod ‘Firebase/Database’
pod ‘Firebase/Auth’
Good luck!
P.S. You will also have to edit your codebase because Firebase 3 is different than Firebase 2. Check the documentation here Firebase 3 Examples
Above answers look great. I'll just add one link that has a lot of the common differences between Firebase 2 and Firebase 3: https://firebase.google.com/support/guides/firebase-ios#get_a_database_reference_numbered
(I didn't see this at first and wasted a few hours yesterday trying to figure it all out.)