Xcode build with Google UMP SDK fails with 'framework not found' - ios

We make middleware using Cordova and AdMob to show ads. Cordova generates an Xcode project for us. However the resulting Xcode projects now fail to build with the error ld: framework not found UserMessagingPlatform.xcframework.
This appears to be caused by the Google UMP SDK updating to version 1.3.0, which notes "Updated the SDK from a .framework to a .xcframework." I've contacted AdMob support, and they claim the build works for them and haven't provided any useful help.
I have no idea why our builds now fail and I'm at a loss as to what to do about it. Here is a sample Xcode project: https://www.dropbox.com/s/y1ly2c3yi45rop6/TestBuild.ios.project.zip?dl=0
Can anyone identify what has gone wrong with this Xcode project causing it to fail to build, and identify a workaround?

The Issue
The issue appears to be that a framework/dependency is not added to the Xcode project, so it doesn't have the code necessary to compile the application. AdMob relies on that UserMessagingPlatform thing to work, and without the Mobile Ads SDK being present in your codebase, UserMessagingPlatform is missing and your application is essentially asking for code that isn't there. To resolve this, you have to tell cocoapods (a dependency manager, think npm but for Swift/Objective-C) to locate and add the missing code to your project.
First, install cocoapods if you haven't already. I used Homebrew to do this, as it seems to be the only method that worked without headache. Many people already have Homebrew, but if you don't, install that first, then run:
brew install cocoapods
Next, go into your project directory using the Terminal. Once you're in the directory, run:
pod install --repo-update
Reopen your project in Xcode, and it should compile successfully now.
Step by step resolution:
Skip any steps that aren't necessary for your environment.
Install Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install cocoapods: brew install cocoapods
Open a terminal, navigate to your project directory: cd /path/to/your/project
Update dependencies: pod install --repo-update
Disclaimer: I'm not a Swift or Objective-C developer, and my experience with Apple/Xcode is limited. I also am unfamiliar with "cocoapods" and AdMob. I just downloaded the sample code and worked through the issue until I got it to compile successfully.

Are you using Cocoapods for your XCode project?
This stackoverflow answer suggest updating cocoapods
Try updating cocoapods:
sudo gem install cocoapods
Cocoapods changelog contains fixes for XCFrameworks

.xcframework files can only be used on CocoaPods 1.10.0 or newer, in your sample app you were using 1.8.4.
Update CocoaPods to latest and run pod install again.

Related

React Native Invalid Podfile file: [!] Unable to locate the executable node

I'm using Macbook pro-2020 apple M1 Chip, I have created a new ReactNative project and it runs fine on the simulator but if i have to install any other plugins, and have to install pods. it gives me errors like this.
i have installed all the requirements app running fine but once it comes pod installs it fails each and every time. any help would be much appericiated.
I believe this has been answered in how-to-running-cocoapods-on-apple-silicon-m1
I recommend following the updated answer for 2022. If you haven't already, use Homebrew, even tho it's not recommended by the maintainers. M1 with ARM architecture is amazing but many libraries are still not compatible and need to be run in x86 mode.
I would uninstall everything, including and gems you used originally, and run the following Homebrew commands and link them all....
brew install node
brew install yarn
brew install cocoapods
Reinstalling those should now work when you run pod install inside your ios file. This is what worked for me. Hope this helps.
I was facing the same error, this is what worked for me:
I first reinstalled the node, yarn, CocoaPods, after that I run the following commands:
brew link cocoapods
If still gives you error, remove old linked pod using following command:
rm '/opt/homebrew/bin/pod'
Now run this command again:
brew link cocoapods
Once the above command works successfully, then move to your project's iOS folder and run the following command:
pod install

"GoogleSignIn/GoogleSignIn.h" file not found

I am using Ionic with the google Plus cordova plugin: https://ionicframework.com/docs/v3/native/google-plus/
I set up everything correctly and it works without any problems on Android.
On iOS I used the command "Ionic cordova prepare iOS", at first I got problems with some Cocoapods ("cannot run cocoapods as root"), I fixed that Error with the help of this post: Can't run sudo pod install after updating to cocoapods 0.32.1 with error "You cannot run CocoaPods as root. (CLAide::Help)". After that I was able to get a .xcodeproj.
After some research I found out I have to open the .xcworkspace.
I clicked on run and got the Error: "GoogleSignIn/GoogleSignIn.h" file not found
Uninstall plugin : cordova plugin rm cordova-plugin-googleplus
Install plugin version 7.0.1: cordova plugin add cordova-plugin-googleplus#7.0.1
This will fix your problem reason being version 7.0.1 doesn't use POD dependencies.
Solution: downgrade cordova-plugin-googleplus to version 7.0.2
If you are using Firebase make sure that your podfile is not written GoogleUtilities, if so delete it, and leave only GooglePlus. Then give
pod install
to the root of your project and that's it.
Accepted the answer from ch3t. However on installing you need to supply the app specific variables as seen below. For reference visit the link https://github.com/EddyVerbruggen/cordova-plugin-googleplus/blob/master/README.md#4-installation-phonegap-cli--cordova-cli
cordova plugin add cordova-plugin-googleplus#7.0.2 --save --variable REVERSED_CLIENT_ID=myreversedclientid --variable WEB_APPLICATION_CLIENT_ID=mywebapplicationclientid
I had encountered with the same problem and solved it by this:
Copy ios/RNGoogleSignin into Libraries folder in Xcode
Add this line to Framework Search Paths in Build Settings:
$(PROJECT_DIR)/GoogleSDK
Remove libRNGoogleSign.a from Link Binary With Libraries in Build
Phases:
And lastly clean your build folder and build.
Credits to: taingmeng
I used an old mac, that was the problem

Swift and Xcode: How to Build and Run a GitHub repository of iOS Application?

I'm interested on Running this GitHub repository of an iOS Application: https://github.com/septadev/SEPTA-iOS I opened the iSEPTA.xcodeproj file on XCode from the iSEPTA folder, but I'm getting these Buildtime Errors. For example: No such module 'ReSwift', and this is the window I get prompted when I select any of the yellow alerts, I'm not sure if I should perform these changes, yet.
Could it be some incomparability with my XCode and Swift versions?
Please, help!!
This project uses Carthage as a dependency management system for using external dependencies.
You should install Carthage to your computer and then run carthage update from the terminal in the root directory of the project. This will instal the dependencies and will allow you to run the project.
Take a look at Cartfile: it indicates this repo is using Carthage package manager. Follow their instructions to install dependent libraries
This repository requires Carthage ( https://github.com/Carthage/Carthage ) - this is a dependency manager. You can install it using Homebrew (https://brew.sh/)
brew install carthage
then you have to run carthageBuild.sh script (which runs carthage update):
./carthageBuild.sh
and then you have to open: Septa.xcworkspace file
This would be the correct solution if the project used Cocoapods. Since it uses Carthage, look to others answers unless you are referencing this answer to a similar issue.
You need to use Cocoapods to integrate the pods attached to the project. Often times projects will not come with them precompiled. Either you opened the blue project file with the *.xcodeproj extension instead of the white project file with the *.xcworkspace extension.... or you don't have the pods installed at all. In which case read below.
Instructions as follows:
cd to project directory
Install Cocoapods
sudo gem install cocoapods
Ensure the you have the given pods in your repo collection for install
pod repo update
Install the pods
pod install
Validate Project Settings
This is necessary until cocoapods v1.6 release (beta is out).
Open the white project file with the *.xcworkspace extension
After those steps are complete, the project should run normally.

How to install older version on carthage

I need to have carthage for running Appium tests.
While Appium community is still working on supporting XCode9.2, we need to rely on XCode 8.3.3
OS: MacOS High Sierria
XCode version: XCode 8.3.3
Java: 1.9
But when I run command brew install carthage, I am getting below error:
Error: Your Xcode (8.3.3) is too outdated.
Please refer below link, which implies that- XCode9 support for Appium is not yet rolled-out
[https://github.com/facebook/WebDriverAgent/issues/639][1]
Kindly suggest work around in meanwhile.
Thanks
1) First of all be sure to remove everything:
brew uninstall --force carthage
2) Then search the commit that you like from here:
https://github.com/Homebrew/homebrew-core/search?p=2&q=carthage&type=Commits&utf8=✓
3) in your case might be this:
https://github.com/Homebrew/homebrew-core/commit/f74d9ba598c9843552450abeb382cacd0e71d4c0
the one related to Carthage v0.24, which should be compatible with your requirement of working with Xcode 8.3.3.
4) then get the commit identifier f74d9ba598c9843552450abeb382cacd0e71d4c0 and run:
brew install https://github.com/Homebrew/homebrew-core/raw/f74d9ba598c9843552450abeb382cacd0e71d4c0/Formula/carthage.rb
I was having the same problem, but was unable to use brew install. I kept getting a 404 error when trying to do it.
To get an old version I cloned the Carthage project from the repo, changed my working copy to the specified version tag I needed and ran make install. This worked :D

Carthage update is failing with error 'could not posix spawn 35'

I have an application which was developed in Xcode 7.3 and Swift 2. Now I am trying to convert it to Swift 3.0.2, as the dependency manager I am using is Carthage. Now I am updating my Carthage so that all the frameworks should support swift 3.0.2. For this, first I have used the following command:
"carthage update --platform iOS"
It now fetches all the dependencies and check out all the dependencies but then after checkout it starts to build the dependencies and while building the dependency it just fails with an error.
Here is a attached screenshot of the error. I am totally blank on what I am missing in this case:
When I faced the problem , this is how I resolved it:
I deleted everything that was checked out and got all new fetches and builds
Ran carthage update --no-build && carthage bootstrap
This problem mainly occurs in Xcode 7.3 beta2 (7D129n) toolchain. Carthage version0.12 will build the cartfile successfully if you set xcselect to 7.2.1.
Version v0.11 didn't have this problem. The problem occurs during the build, maybe because all the versions of Carthage dependencies don't match too. I also read a few posts which asked me to supply with sudo carthage update --platform iOS --no-use-binaries.
And you're using a really old version of Xcode. I'll suggest you to upgrade.

Resources