i'm trying to add OneSignal sdk to my project via cocoapods and then implementing the push notification module with NotificationServiceExtension.
My problem is when i run my project i have this warning Already swizzled UIApplication.setDelegate. Make sure the OneSignal library wasn't loaded into the runtime twice! and then i can't subscribe to OneSignal server.
I'm sure that the problem is coming from my pod file config because when i removed the OneSignal pod from AppKit the warning disappear and i can subscribe to the notification server, but i can't delete this pod from there because i need it later.
Here's my pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
def common_pods
use_frameworks!
pod 'RxSwift', '~> 5'
pod 'RxCocoa', '~> 5'
end
def shared_one_signal_pod
use_frameworks!
pod 'OneSignal', '2.12.6'
end
use_frameworks!
target 'App' do
common_pods
shared_one_signal_pod
target 'AppTestTests' do
#inherit! :search_paths
# Pods for testing
end
target 'AppOneSignalNotificationServiceExtension' do
inherit! :search_paths
end
end
target 'App_iOS' do
common_pods
end
target 'AppKit' do
common_pods
pod 'Socket.IO-Client-Swift', '~> 15.2.0'
shared_one_signal_pod
end
target 'AppUIKit' do
common_pods
end
As you can see my project is decomposed to 3 local framework (iOS, Kit, UIKit) and my App target. So is there a way to make that pod load once at runtime ??
Related
Is there a way to write a single cartfile which can be used to install the dependencies required for multiple targets. This can be achieved when we're using Cocoapods as shown below:
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
def rx_swift
pod 'RxSwift', '~> 4.0'
end
def rx_cocoa
pod 'RxCocoa', '~> 4.0'
end
def test_pods
pod 'RxTest'
pod 'RxBlocking'
pod 'Nimble'
end
target 'CleanArchitectureRxSwift' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_cocoa
rx_swift
pod 'QueryKit'
target 'CleanArchitectureRxSwiftTests' do
inherit! :search_paths
test_pods
end
end
target 'CoreDataPlatform' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
pod 'QueryKit'
target 'CoreDataPlatformTests' do
inherit! :search_paths
test_pods
end
end
target 'Domain' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
target 'DomainTests' do
inherit! :search_paths
test_pods
end
end
target 'NetworkPlatform' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
pod 'Alamofire'
pod 'RxAlamofire'
target 'NetworkPlatformTests' do
inherit! :search_paths
test_pods
end
end
target 'RealmPlatform' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
rx_swift
pod 'RxRealm', '~> 0.7.1'
pod 'QueryKit'
pod 'RealmSwift', '~> 3.10'
pod 'Realm', '~> 3.10'
target 'RealmPlatformTests' do
inherit! :search_paths
test_pods
end
end
Please let me know whether can we achieve similar thing while using Carthage? i.e. by writing all the dependencies needed for all targets in a single cartfile and then installing them using carthage?
Why I want to do this is, I feel that as we go on adding dependencies to different targets(frameworks) used in the application, it'd be easy to maintain if we have all the dependencies listed in a single cartfile.
Thanks in advance.
It's not possible to do this in Carthage, and will probably never be supported.
You could list all the dependencies in a single Cartfile, but you'll still have to manually select and add them to your target's linked frameworks and libraries.
When defining my Podfile as below, and then building my app with my extension I get a build error in the DKImagePickerController framework with an error similar to this: Error "'sharedApplication' is unavailable: not available on iOS (App Extension)...." when compiling after pod update
As you can see I have not included the DKImagePickerController framework in my extension target in my Podfile, so I'm wondering what I am doing wrong?
platform :ios, '10.0'
def base_pods
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'DKImagePickerController', '~> 3.4.0'
...
pod 'SAMKeychain'
end
target 'MyApp' do
use_frameworks!
base_pods
target 'MyAppExtension' do
pod 'Firebase/Auth'
pod 'SAMKeychain'
end
target 'MyAppUnitTests' do
inherit! :search_paths
pod 'Firebase'
pod 'FirebaseAuth'
pod 'FirebaseUI/Auth'
end
end
Update
I appreciate that I am getting the error due to an API being unavailable, what I am trying to figure out is how to avoid it. My suspicion is on my podfile, hence my question :)
I had the same issue, so for anyone else finding this thread, I was able to solve the problem by creating two top-level targets instead of using a nested target.
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Eureka', '~> 3.0'
pod 'ChameleonFramework', '~> 2.0'
pod 'SharedPod', '~>1.0'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp Today' do
use_frameworks!
# inherit! :none
# Pods for MyApp Today
pod 'SharedPod', '~>1.0'
end
To get a clean start I then ran...
pod deintegrate
-- Then cleaned out the project file in XCode
pod install
There are few API's which are unavailable in App Extension's. One of them is UIApplication. The framework developer has to make sure this never happens. https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionOverview.html#//apple_ref/doc/uid/TP40014214-CH2-SW6
I am trying to import Firebase into my Xcode file via Cocoapods 1.1.1. My pod file looks something like this.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Firebase Login' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Firebase Login
pod 'Firebase', '~> 3.11'
target 'Firebase LoginTests' do
inherit! :search_paths
pod 'Firebase'
end
target 'Firebase LoginUITests' do
inherit! :search_paths
# Pods for testing
end
end
I also tried this.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Firebase Login' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Firebase Login
target 'Firebase LoginTests' do
inherit! :search_paths
pod 'Firebase'
end
target 'Firebase LoginUITests' do
inherit! :search_paths
# Pods for testing
end
end
Afterwards, I typed pod install in my terminal and this is what I got.
Analyzing dependencies
[!] Unable to find a specification for `FirebaseAnalytics (= 3.6.0)` depended upon by `Firebase/Core`
Is this something I have done wrong or is it a bug with Firebase itself? If it's me, I would appreciate it if someone can help me solve this problem.
You should add those pods before target 'Firebase LoginTests' do
Otherwise you will only include them your test target.
your podfiel should look like this
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'AppName' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for AppName
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
target 'AppName' do
inherit! :search_paths
# Pods for testing
end
target 'AppName' do
inherit! :search_paths
# Pods for testing
end
end
I have been looking up on every website that had a similar/identical issue to this Xcode error and I have tried everything and nothing has worked. Most people say cleaning and building the project will make Firebase recognized but that hasn't worked. I've tried a bunch of different framework search paths but each framework is in a different folder, not one framework folder. This is my podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'Target' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Target
target 'TargetTests' do
inherit! :search_paths
pod 'Firebase', '>= 2.5.0'
# Pods for testing
end
end
these are my project folders
i've tried making my framework search path $(SRCROOT) and all variations and nothing works. My issue seems to be unlike any other that I can find from googling. I suspect its the framework search path but i don't know what to make it, and I could be wrong.
Any help would be greatly appreciated.
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Promposal
target 'Promposal' do
pod 'Firebase', '>= 2.5.0'
# Pods for testing
target 'PromposalTests' do
inherit! :search_paths
pod 'Firebase', '>= 2.5.0'
end
end
You were writing your podfile properly and you were adding the Firebase only to the test. Try this podfile and check.
It was good for me:
platform :ios, '10.0'
use_frameworks!
def shared_pods
pod 'Firebase'
end
target 'TargetName' do
shared_pods
end
target 'TargetNameDev' do
shared_pods
end
I am really stuck at this step of Firebase Installation to my iOS app.Firebase installation to Xcode I tried many times and finally I could install some 'pod files' to my project. But when i add import Firebase, error shown like
No such module 'Firebase'
Can anyone tell me how to install firebase pod into my existing ios project ? Also how to clear the pod I just installed to it.
I am using swift 2.2, Scode 7.3 and mac os x ei
my pod content is
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target ‘APPNAME’ do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for APPNAME
target 'APPNAME Tests' do
inherit! :search_paths
# Pods for testing
end
target 'APPNAME UITests' do
inherit! :search_paths
# Pods for testing
end
end
My Error :
image of my error
Add This Line in your pod file
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target ‘APPNAME’ do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase', '>= 2.5.1'
# Pods for APPNAME
target 'APPNAME Tests' do
inherit! :search_paths
# Pods for testing
end
target 'APPNAME UITests' do
inherit! :search_paths
# Pods for testing
end
end
and after that update pod