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
Related
I was using Xcode 12.5.1 for my iOS App which has iOS Deployment Target iOS12 it was working fine
After I tried to open this project in Xcode 13 I got multiple errors in some libraries like "ImagePicker", "Kingfisher", "FittedSheets"
The error: Command CompileSwiftSources failed with a nonzero exit code
I tried to run pod update but it didn't help me still same errors
My Podfile looks like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '12.0'
target 'MyApp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Firebase/Messaging'
pod 'Firebase/Storage'
pod 'Firebase/Database'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
pod 'FittedSheets'
pod 'ImagePicker'
pod 'Lightbox'
pod 'Hue'
pod 'Kingfisher', '~> 5.0'
pod 'Firebase/Functions'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
I use iOS 12 as iOS Deployment Target for MyApp and the same I tried to use for failed Pods.
I tried various solutions like setting all Pods to iOS12 as iOS Target but nothing really worked for me anyone knows other solution how to fix it ?
So it seems like maybe you have a class called Configuration? You will need to give it a different name, or qualify it with a namespace, because now UIButton also has a class called Configuration and so there's a naming conflict.
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 ??
How can I install pods for an extension also named as Widget in my app. I'm already having that pod installed for my app target.
I've looked online and the solution that I found has got me errors like one in the screenshot.
Following is the code in my pods file:
platform :ios, '9.0'
use_frameworks!
target 'myapp' do
pod 'Alamofire', '~> 4.8.0'
end
target 'myapp_extension' do
pod 'Alamofire', '~> 4.8.0'
end
Multiple commands produce '/Users/abc/Library/Developer/Xcode/DerivedData/myapp-hitzznvtnviylfcammkfaxjvlryg/Build/Products/Debug-iphonesimulator/myapp.app/Frameworks/nanopb.framework':
1) That command depends on command in Target 'myapp' (project 'myapp'): script phase “[CP] Embed Pods Frameworks”
2) That command depends on command in Target 'myapp' (project 'myapp'): script phase “[CP] Embed Pods Frameworks”
You can use inherit! :search_paths to add same pods to your extensions
platform: ios, '9.0'
target 'myapp' do
use_frameworks!
pod 'Alamofire', '~> 4.8.0'
target 'myapp_extension' do
inherit! :search_paths
end
end
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 am trying to add FirebaseUI/Storage pod to iOS App which is throwing the following linker error:
framework not found SDWebImage for architecture x86_64
I have tried adding SDWebImage independently and it works but as soon as I add FirebaseUI/Storage pod, it throws the above error.
Any ideas what could be causing this?
This is what my Podfile looks like:
target 'myApp' do
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'SDWebImage'
pod 'MMDrawerController'
end
I had this exact same problem. I seem to have fixed it by changing my pod file to...
target 'MyApp' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'SDWebImage', '~>3.8'
# pod 'Firebase/Core'
pod 'FirebaseUI', '~> 1.0'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
A few things to note:
I turned on use_frameworks even though I am using Objective C
I turned off my Firebase pod calls - they are pulled in automatically by FirebaseUI
Seems like there is no clear documentation regarding which pods to include to enable just the FirebaseUI/Storage functionality if also including other individual Firebase/... pods.
I needed to remove all pods and install them back without FirebaseUI/Storage since it duped several classes which were not removed once I removed the [FirebaseUI/Storage] pod.