Xcode 9 fails to build Swift 4 project with pod - swift

When attempting to build my Swift 4 project in Xcode 9 beta 2, some code signing error occurs after which the build of my app is discontinued.
The error that is shown in Xcode:
/usr/bin/codesign --force --sign - --preserve-metadata=identifier,entitlements '/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework'
/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework: No such file or directory
As you might notice, the --sign argument is followed by a single - character.
My setup:
Xcode 9 beta 2 (9M137d) with its bundled Swift 4-version
Cocoapods v1.2.1 with Podfile
platform :ios, '10.0'
target 'Emprova GPS Demo Swift' do
use_frameworks!
pod 'Alamofire', '~> 4.5.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
pod 'KeyClip'
pod 'Localize-Swift', '~> 1.7.1'
pod 'FMDB'
end
target 'Emprova GPS Swift' do
use_frameworks!
pod 'Alamofire', '~> 4.5.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
pod 'KeyClip'
pod 'Localize-Swift', '~> 1.7.1'
pod 'FMDB'
end
I didn't change a single letter of any of the added pods files.
I opened Pods.xcodeproj to check and double check Build Settings - Code Signing Identitiy of the Alamofire pod/target, but it is set to Don't Code Sign.
I already checked my Keychain Access app to see if the Apple Worldwide Developer Relations Certification Authority wasn't expired (it isn't) and is marked as trusted (it is).
I already emptied the DerivedData directory multiple times (~/Library/Developer/Xcode/DerivedData) and performed a Clean (both via Cmd+K and Cmd+Alt+Shift+K to no avail.
I already attempted to set the Xcode 'Command Line Tools' (Preferences - Locations - Command Line Tools) to both Xcode 8.3.3 (8E3004b) and Xcode 9.0 (9M137d) to no avail.
Completely ran out of ideas after having spent multiple hours searching for a solution. Does anyone have a clue why Xcode 9 no longer builds my project?
Also, link to my issue on Alamofires GitHub page, for the sake of completeness: #2183.

I found out what's wrong! Xcode continued using the .xcodeproj file to open my project when selecting it on the welcome screen, but Cocoapods requires the .xcworkspace file to be used! There's a visual distinction between both entries on Xcode's Welcome screen afterwards: difference between Xcode workspace and project on Welcome screen.
Opening the workspace shows two projects in Xcode's Project Navigator: one for my app and a second one named Pods, which embodies all installed pods. Building the app no longer shows weird build errors.

Related

Trying to install GeoFire through Cocoapods, but getting Objective-C Module error

So there is an odd build issue I’m encountering.
I have an existing Xcode project where all my packages have been added through Xcode itself (I think Xcode basically uses Swift Package Manager underneath).
I came to a point where I needed to now use GeoFire . But Geofire needs to be installed through Cocoapods. But my Xcode project never used cocoapods.
So to integrate Cocoapods I did the following:
brew install cocoapods
opened terminal and navigated to root directory of iOS app (where <app-name>.xcodeproj exists)
pod init
opened the generated Podfile and added the following:
…
platform :ios, '11.0’
…
pod 'GeoFire', '~> 4.0’
…
pod install
opened <app-name>.xcworkspace
Then when I went to build the project, the following failure occurred (see image attached to question)
None of the workarounds suggested have helped me thus far. Any thoughts?
NOTE: I am doing all this on an M1 Macbook.
Wow, strange issue.
What ended up fixing it for me was to go to my pod file and replace:
pod 'GeoFire', '~> 4.0'
With:
pod 'GeoFire/Utils'
Now I can use GeoFire in my file as I wish.

xcode: no such module 'Kingfisher'

I want run my app on emulator
But I get this error:
no such module 'Kingfisher'
pod update, pod install, delete DerivedData folder, restart xcode, use xcworkspace, use xcodeproj and ... not solved my problem!
OS: 11.4
xcode: 12.4
My pod:
platform :ios, '11.0'
use_frameworks!
target 'Name' do
pod 'QuickBlox'
pod 'Quickblox-WebRTC'
pod 'Alamofire'
pod 'Kingfisher'
pod 'NVActivityIndicatorView/Extended'
pod 'PulsingHalo'
pod 'ImageScrollView'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end
please use these commands in order in the project directory
1- pod deintegrate
2- rm podfile.lock
3- pod install
then clean project and build it should work
It happens to me sometimes.
first, clean build and then rebuild the project.
if there is no success try pod install, otherwise restart your device.
In my case Kingfisher worked with iOS and not with macOS. I used Xcodes package installer and not pod install. In order to fix my "no such module 'Kingfisher'" error for macOS:
I had to go to my TARGETS. (on the left side of General/Signing/etc)
Click on your macOS target.
Click "Build Phases" (2nd to last on the top row)
Go down to 'Link Binary with libraries.'
Click the '+' button and add the Kingfisher library.
If you have the error in your iOS version then add the library to that target instead. This won't fix everyone's issue, but no other solution I could find online worked and finally after clicking around I found this library was missing and it fixed my error, so I hope it helps someone.
Adding this to podfile helps me
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end

Firebase Cocoapods - Error message; Could not build Objective-C module 'Firebase

I'm trying to import Firebase after installing Cocoapods via terminal but i'm getting the following error message:
Could not build Objective-C module 'Firebase
Can someone help me out with this?
This is my Podfile content:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Login_test' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Login_test
pod 'Firebase/Core'
end
Assuming that you have installed FireBase properly via CocoaPods. Try the following steps
Step 1 - Close Xcode
Step 2 - Clear your derived data. You can find your derived data in here
~/Library/Developer/Xcode/DerivedData
Step 3 - Open your .xcworkspace
Step 4 - Clean your project (⌘+Shift+K)
Step 5 - Build your project (⌘+B)
Hope this helps.
for beginners:
make sure you read the message after installing the Pod,
you need to close the xcode project and use the .xcworkspace for this project from now on.
For me the issue was simple. I have a new m1 mac and it has trouble loading cocoa pods sometimes. Simply click your pods project(blue pods)->Click all & build settings ->Excluded architectures -> add "arm64" to both debug and release -> set any SDK on left side -> do this on your main project folder too -> build it your good to go
See Example

When I compile the application I get an error equal to this: Could not build Objective-C module 'Firebase'

None of my 'Firebase' pods are found.
I updated to Xcode 9.
Ran 'pod update'
deitegrated my pods, and re-installed
Deleted 'Derived Data' folder contents
Build from 'Generic Devices'
Added the paths in the Header Search Path in the Build Settings $(inherited)
and
"$(SRCROOT)/Pods"
and
"${PODS_ROOT}/Firebase/Core/Sources"
Cleaned, build, closed the app, re-installed Xcode, restarted the system, and did it all again.
2 Swift Compiler Errors are always there.
'FirebaseAnalytics/FirebaseAnalytics.h' file not found
and
Could not build Objective-C module 'Firebase'
I'm on Sierra 10.12.6
None of these has worked so far to get rid of them. Does anyone know of any other possible solutions?
Here is the pod file info.
Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MP' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MP
pod 'Firebase'
pod 'Firebase/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
end
------ UPDATE ------
as Hexfire suggested below. I removed pods and manually added the frameworks.
After some fiddling with the pathing for my MP.h file, that first error is gone, however now I am getting these compiler errors now...
:0: error: PCH file '/Users/.../Library/Developer/Xcode/DerivedData/MP-gwnwsbrisiyspxepcxkbrojwtfrs/Build/Intermediates.noindex/PrecompiledHeaders/MP-swift_ZJX6RAPYV1IT-clang_2SW1CJQDTFSBO.pch' not found: module file not found
clang importer creation failed
I built a .pch file 'MP.pch' and I pointed to it in the Build Settings Prefix Header with $(SRCROOT) with no luck. Do I have to put all of my Framework paths in there as well?
All of this seems related to the search paths. Does anyone have any other thoughts here? Perhaps an example of the build settings syntax? For example $(SRCROOT) with quotes or without? $(SRCROOT)/MP.pch or just $(SRCROOT)?
One of the good ways to make this work is by not using CocoaPods. You can grab all necessary Firebase libraries from here and use within your app (if link doesn't work, go here, and scroll down to "Integrate without CocoaPods").
After downloading:
Unzip and see the README file for which Frameworks to include in to your project.
Add the ObjC linker flag in your Other Linker Settings in your target's build settings.
This is a valid option and 100% workable.
P.S. If Firebase is the only pod you are using, you can quickly and safely clean your project from any CocoaPods trails by using pod deintegrate command.
Good luck!
If All Of this do not work Try this for once
run sudo gem install cocoapods
You can check your version by typing pod --version anywhere on your terminal.
Make sure you are using latest Version of it

cocoapods Google Mobile ads does not generate .xcworkspace file

I am exporting a project from Unity3d to xcode that uses the last GoogleMobileAds package.
I have installed and updated cocoapods and also have the famous podfile containing de following lines:
source 'https://github.com/CocoaPods/Specs.git'
install! 'cocoapods', :integrate_targets => false
platform :ios, ‘8.0’
target ‘MyProject’ do
pod 'Google-Mobile-Ads-SDK', '~> 7.14’
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
and I run
pod install
and
pod update
successfully
dependancies are downloaded alright, as you can see the results below:
Updating local specs repositories
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Analyzing dependencies
Downloading dependencies
Using Firebase (3.9.0)
Using FirebaseAnalytics (3.5.1)
Using FirebaseCore (3.4.4)
Using FirebaseInstanceID (1.0.8)
Installing Google-Mobile-Ads-SDK (7.14.0)
Using GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleToolboxForMac (2.1.0)
Generating Pods project
Skipping User Project Integration
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 8 total pods installed.
According to both cocoapods and google mobile ads documentation, I will need to continue with "MyProject.xcworkspace" but the file is nowhere to be found.
any suggestions?
When using install! 'cocoapods', :integrate_targets => false Cocoapods will not create an xcworkspace for you.
That's the intended behaviour. You'll even notice this if you follow the command prompt. This line is telling you that no integration is taking place.
Skipping User Project Integration
If you want to get an xcworkspace just remove :integrate_targets => false
It seems the problem comes from editing the Podfile using TextEdit.
As it warns you that you should not continue using TextEdit, one could falsely suppose that the program is intelligent enough to understand and correct these unwanted modifications.
This is the solution I have found:
delete the Podfile and Podfile.lock from your working directory
create a new Podfile using pod init
install SublimeText and use it to open the Podfile
add the necessary pods for the project
(I also included the line "use_frameworks!" although it may not be
needed.)
run "pod install" and "pod update"; this time I get
[!] Please close any current Xcode sessions and use Orbit.xcworkspace for this project from now on.
and the file is now available in project directory
You was used this guide for install pod?
In addition to Radu Dita's message. If you do not want that line to be added (so you do not need to delete it later), you need to disable cocoapods integration in "iOS Resolver Settings" by selecting "None", build project and then enable it back "Xcode Workspace". I found this with try and error. I hope my message will save save someone's time