Xcode 13 Build failed Command COmpileSwiftSources failed - ios

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.

Related

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.

How to define pod file for iOS Extension

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

Adding FirebaseUI/Storage pod to iOS App throws framework not found SDWebImage for architecture x86_64

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.

The bundle UITests couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle

I can't run my test case due to this following errors :
The bundle “UITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
Library not loaded: #rpath/Alamofire.framework/Alamofire.
Reason: image not found
Try searching and solving since two days but couldn't get through this issue can someone please help.
I was able to reproduce this issue with the project generated by Xcode 10.1. I used Swift 4.2 and CocoaPods 1.10.0 as a dependency manager. I had the following Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
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 'Alamofire', '4.8.1'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
Then I removed use_frameworks!, see this link for more details:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MyApp' do
# Pods for MyApp
pod 'Alamofire', '4.8.1'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
I also received some warnings like this:
[!] The `MyAppUITests [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-MyApp-MyAppUITests/Pods-MyApp-MyAppUITests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
That's why I removed this line from the MyAppUITests build settings:
After that run pod deintegrate && pod install and then the problem disappeared.
Probably for projects with more dependencies (like here) you need to use another solution.
It's because your pods only apply to your Framework target and no the tests one. Add the tests target to your podfile.
Example :
target 'MyFramework' do
use_frameworks!
pod 'Alamofire', '~> 4.5'
end
target 'MyFrameworkTests' do
use_frameworks!
pod 'Alamofire', '~> 4.5'
end
In your tests target change inherit! :search_paths to inherit! :complete.
See the documentation for what this does.
Check that the deployment target in your UITest target Build Settings is set to the same as the host application you are trying to test. In my case, I added the UITesting target later on, and it created it with a default of deployment target iOS 12. If you then try to run the UITest on iOS lower than 12, it gave me the error mentioned in the question.
In my case, I needed to separate the UI tests target with use_frameworks!.
Moving the UI tests target from nested structure to its own will not help, if you specified use_frameworks! globally somewhere in the top of the Podfile.
The Podfile with error (original):
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
target 'MyProject' do
pod 'R.swift', '~> 5.0'
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
target 'MyProjectUITests' do
inherit! :search_paths
end
end
The Podfile with error (first try to fix):
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
def shared_pods
pod 'R.swift', '~> 5.0'
end
target 'MyProject' do
shared_pods
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
end
target 'MyProjectUITests' do
shared_pods
end
The final working Podfile:
platform :ios, '10.0'
inhibit_all_warnings!
def shared_pods
pod 'R.swift', '~> 5.0'
end
target 'MyProject' do
use_frameworks!
shared_pods
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
end
target 'MyProjectUITests' do
shared_pods
end
I had to add the location of my frameworks to Runpath search Path under targets>mytestTarget>Build Settings>Runpath Search Path
This error happened to me when I added a framework to the project (that's a framework itself, too), and tried to run the tests. I made it optional instead of required, and the tests succeeded.
Switching to legacy build system fixed thi issue with Xcode 10.
For anyone encountering this issue using Carthage, I solved it by adding the /usr/local/bin/carthage copy-frameworks run script phase to the UITest target (rather than just my main app target), and added the framework as an input file.
The bundle UITests couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle
I have run on this problem when tried to run UI Testing Bundle for testing a Framework
The solution is simple:
Build Phases -> + -> New Copy Files Phase -> <select a framework> -> Destination Frameworks
As a result <UI_Testing_Bundle_name>-Runner.app is generated
]3
Go To Build Phases
Open Copy Pods Resources and copy the path
Paste the path that you have copied from Copy Pods Resources and change tag name resources with frameworks
Clean and Build
Run your UITestsFile
What solved my problem was following the following steps:
1) delete the UITests target from the pod file.
Initially, I had the following in the pod file:
target 'XUITests' do
inherit! :search_paths
end
2) Deintegrate the pods (with pod deintegrate)
3) Install the pods (with pod install)
4) Clean your project and run the project or your UITest
In my case, just removing inherit! :search_paths without changing the structure of the file or duplicating any pod fixed my problem.
I saw the answer but without an explanation so decided to post mine.
The issue is that UI tests performed in a separate application that controls the main one and so it can't use the main application's frameworks and so if you just inherit paths to frameworks using Cocoapods UI tests app will crash at the startup.
To fix the issue you need to actually copy frameworks to UI tests app or update your Podfile:
use_frameworks!
target 'App' do
pod 'Alamofire'
target 'App_UnitTests' do
inherit! :search_paths
pod 'Quick'
pod 'Nimble'
end
end
target 'App_UITests' do
pod 'Alamofire'
end
Xcode 11.2 using Apollo framework within another framework. Instead of changing to optional/required, I fixed it by setting to embed.
With this specific error:
The bundle “XXX” couldn’t be loaded because it is damaged or missing
necessary resources. Try reinstalling the bundle. Library not loaded:
#rpath/Apollo.framework/Apollo
I had to embed the framework
For me, the error was when build the UITests.
The solution:
The Targer was with a wrong iOS version, I replace with the same version that the tested Target and everything works!!
For me, this problem was caused by me referencing a property from an extension on a UIKit class from a framework which wasn't imported in the file where it was referenced. Fixed by not using that property. I'm not sure why it compiled in the first place - that should have been a compile-time error, not a runtime error.
In my case simply choosing "My Mac" instead of "My Mac (Mac Catalyst)" allowed me to run the tests.
Try copy every pod for your app target to the UI testing target.
2019 it works.
If you are in fact using Cocoapods, you probably just need to run "pod install" and the build settings will be updated automatically.

Firebase pod installation error

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

Resources