"GoogleSignIn/GoogleSignIn.h" file not found - ios

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

Related

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

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.

Build fail for google-signin package in react-native?

I am trying to implement react-native-google-sigin package to my react-native Ios project . I have configured everything.
But now the problem if I include google framework to my project there is a pop an error and As soon as I remove it. It works!!
I really don't know why m getting build fail with the following error
Every time i include ios/GoogleSdk frameworks in my project.
I don't know why or how but I ran into this issue and after numerous cleans, DerivedData deletes etc., the solution that worked for me was to follow XCode's advice on upgrading to the recommended settings and changing the iOS Deployment Target of RNGoogleSignIn project to 8.0. I'm using XCode 9 if that helps.
This is how I solved this:
rm -rf node_modules/ ios/
(Copied my podfile to another location)
npm install & react-native upgrade
(this will give me a error free start cause by react-native link)
cp my podfile inside ios/ Pod install
Followed the remaining steps from react-native-google-signin
Added the following to my login.js (iosCLientId and CLientId are different Id's)
await GoogleSignin.configure({
iosClientId: 'iosClientId',
webClientId: 'webClientId',
offlineAccess: false
});
Open Xcode Clear and Build the project.
Note: I would have easily removed the googlesdk(frameworks), links and library . But instead I choose to get get a fresh start. Hope this helps anyone

Realm.framework/Headers No such file or directory

ln: It/BuildProductsPath/Release/Realm/Realm.framework/Headers: No such file or directory
ln: It/BuildProductsPath/Release/Realm/Realm.framework/PrivateHeaders: No such file or directory
I can build & run the project, but when I am trying to archive the project, it shows me this error. I have tried cleaning up the project and deleting derived data, but that didn't help me.
I am using Realm in macOS App. I installed macOS 10.12.1 and tried archiving the project, then this error appeared. It was working fine in previous macOS version.
Please help me to solve this, Thanks in Advance.
I have updated to new cocoa pods [ Dmitry pointed out ], now I am using cocoa pods beta version.
I have installed the beta version using this command sudo gem install cocoapods --pre. Now the pod --version command shows me that the cocoa pods version is 1.2.0.beta.1. Tried archiving the project again, but the same error appears.
This is a CocoaPods issue that was fixed in https://github.com/CocoaPods/CocoaPods/pull/6146.
Please try to update to the latest CocoaPods [beta] version.
Looks like the current beta doesn't include that fix, so for now the workaround I suggest is to simply add missing quotes to your project manually:
Select Pods project in project navigator
Select Realm target -> Build Phases
Find Create Symbolic Links to Header Folders and replace the script to
base="$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME"
ln -fs "$base/${PUBLIC_HEADERS_FOLDER_PATH#$WRAPPER_NAME/}" "$base/${PUBLIC_HEADERS_FOLDER_PATH#$CONTENTS_FOLDER_PATH/}"
ln -fs "$base/${PRIVATE_HEADERS_FOLDER_PATH#$WRAPPER_NAME/}" "$base/${PRIVATE_HEADERS_FOLDER_PATH#$CONTENTS_FOLDER_PATH/}"

Missing dependency target "CordovaLib (from CordovaLib.xcodeproj)"

Missing dependency target "CordovaLib (from CordovaLib.xcodeproj)" When running ios with Xcode
A different solution
Before reading this MAKE SURE you are opening YourProject.xcworkspace and NOT YourProject.xcodeproj
I couldn't get this to work using #manzapanza 's solution
The Problem
CordovaLib.xcodeproj is missing from your xcode project
Solution (for mac users)
Download a copy of CordovaLib.xcodeproj and drag it into your xcode project.
$ sudo npm install -g cordova (installs a "global" copy of cordova to your computer, you might be able to skip this step)
$ find ~/ -name 'CordovaLib.xcodeproj' (mine was at /Users/Jackson//.cordova/lib/npm_cache/cordova-ios/4.3.1/package/tests/spec/unit/fixtures/ios-config-xml/CordovaLib/CordovaLib.xcodeproj)
Open folder the folder path found above $ open [path] (open /Users/Jackson//.cordova/lib/npm_cache/cordova-ios/4.3.1/package/tests/spec/unit/fixtures/ios-config-xml/CordovaLib/)
Drag CordovaLib.xcodeproj to your xcode project
This is what your file navigator should look like at this point:
Delete red (missing) file
Select your app in the navigator (very top of file tree). Go to Targets > [Your Project Name] > Build Phases > Link Binary With Libraries > "+"
type in / look for libCordova.a and add it
Compile project
For some reasons the xcode project was corrupted. Generally, to solve this kind of problems, you can try removing and re-adding the platform ios:
ionic platform rm ios
ionic platform add ios
ionic build ios
Attention: Any changes that you applied directly from xcode will be lost and you will need to apply manually after you will have run these commands. Do a backup of platforms/ios before.
Same solution for Apache Cordova project.
Remove platform and re-add:
cordova platform remove ios
cordova platform add ios
cordova prepare ios
cordova run ios
Successful!
I downgraded my Cordova version to 6.2.0 and it started working.
I had multiple issues with my app that I was able to resolve when I was missing CordovaLib from my XCode project.
First I ran
cordova requirements ios
and found that I was missing ios-deploy and CocoaPods. These were not requirements for Cordova 6.2.0 but are as of Cordova 6.4.0. I did not try 6.3.0 so I do not know the status for that version.
In addition, I had some icon files in my config.xml for iOS that did not exist because I was using a 3rd party cordova-icon maker to generate them and the fact that they were missing was apparently breaking the add platform command mid-process. Again 6.2.0 did not have this issue with the same config file, but 6.4.0 is definitely strict about not having any errors. My guess is that they were either continuing past the errors in prior version of Cordova or they re-arranged the way things are built so that the CordovaLib is now last and if there are any errors before that step, you will be missing the folder and its contents.

Error building ios with cordova

I have a problem when I build the ios platform with cordova. I have all the certificates for the app and device, but when I try to run in my ios device, doing ionic run ios, the console return this error:
Error: Source path does not exist: resources/ios/icon/icon-40#3x.png
This path is written in config.xml file.
I tried to run it in xCode but the problem there was:
Cordova/CDVViewController.h not found
I read a lot of possible solutions but any works for me.
My xCode version is 7.3.1, the cordova version is 6.3.0 and the cordova ios version is 4.2.0.
If you are missing the icon you can run the command
ionic resources --icon
This will generate all the icons with the pixels needed to run on any device.
To simulate on the device you first need to
ionic build ios
and then
ionic simulate ios
It is also a good practice to have xcode up to date.
If you are still getting the error you can paste this line
"$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"
on Build Settings > Header Search Paths.
Do not remove the similar line, just add it at the end.
Update - 03-08-2017
> ionic cordova resources
Old CLI command:
I had the same error, and after re-running ionic resources it went away.
The problem was that I had Windows-style slashes (backslashes) in the path of the icon, i.e. the error I had was this:
Error: Source path does not exist: resources\ios\icon\icon-40.png
So, converting backslashes into slashes resolved it for me.
Update:
And regarding your second error, it helped me to reset the state:
ionic state reset
Make sure you have ios listed under cordovaPlatforms in your package.json before running this command. Then ionic automatically re-downloads your plugins afresh and is ready to build.
Hope that helps. Take care!
I've had same error only with other image:
Source path does not exist: resources/ios/icon/icon-40#2x.png
This happened after upgrading to Cordova 6.3.0 and I've solved it downgrading Cordova.
Quickfix for now:
npm uninstall -g cordova
npm install -g cordova#6.2.0
Just use:
Remove platform
cordova platform remove ios
And add ios platform with old one
cordova platform add ios#4.0.0 --save
It worked for me..
#4.0.0 will select previous version automatically
I have try some times, finally success.
use ionic resources --icon , maybe met the new problem
"Unable to generate images due to an error Failed to upload source image: Error: read ECONNRESET"
don't worry , try it later
use ionic platform remove ios
when execute successfully
use ionic platform add ios
DON'T USEionic state reset
Try to replace the "\" with "/" (backslash and slash) in the config.xml.
If you create the project on a Windows system and move to macOS for iOS compilation, it still has the Windows URI format.
I've found this issue in several occasions and some of the provided answers worked quite well till today, when no one worked.
My environment: MacOS high Sierra 10.13, ionic cli 3.18.0 and cordova 7.1.0.
My problem was that if I run ionic cordova prepare it fails saying that I need to add a platform and if a I add a platform with ionic cordova platform add ios it fails with the error specified in the answer:
Error: Source path does not exist: resources/ios/icon/icon-40#3x.png
What solved my issue was manually creating the platforms folder: mkdir platforms. After creating this folder, adding a platform worked as usual.
I hope it could help someone out there.
I got similar issue with cordova-ios#~4.5.1
ionic cordova build ios
> cordova build ios
Error: Source path does not exist: resources\android\icon\drawable-xhdpi-icon.png
[ERROR] An error occurred while running cordova build ios (exit code 1).
ionic cordova platform add ios
> cordova platform add ios --save
Using cordova-fetch for cordova-ios#~4.5.1
Adding ios project...
Creating Cordova project for the iOS platform:
Path: platforms/ios
Package: -
Name: -
iOS project created with cordova-ios#4.5.4
Error: Source path does not exist: resources\android\icon\drawable-xhdpi-icon.png
I remove ios platform
ionic cordova platform remove ios
And add ios platform with old one
ionic cordova platform add ios#4.0.0
This worked for me, waiting for an Cordova update :)
it's a cat and mouse problem,
the icon resources aren't built because the platform isn't added and
platform can't be added because the icon resource isn't there
ionic/cordova is pretty unstable and a nightmare to work with in CI pipeline.
this kept crashing out CI pipeline. just keep removing and adding the android/ios platform and build the resources using ionic cordova resources --force
Running these commands solved it for me:
ionic platform rm ios
ionic resources
ionic platform add ios
I had to manually copy the files from any another project repo
such as https://github.com/sphilee/eTAS_GPS/tree/master/resources/ios
It says that the resources directory only contained empty folders. Downloading this repo (https://github.com/ionic-team/ionic2-app-base/tree/master/resources)
and replace the resources directory
Run again the "ionic cordova resources".
You just need to update the cordova to fix this error: to update the cordova run below command
$sudo npm install -g cordova#6.2.0
once you update the cordova type below command to remove the platform
$sudo ionic cordova platform rm ios --save
And then add platform again using below command
$sudo ionic cordova platform add ios --save
I hope this will help you.
I ran into the same problem:
Error: Source path does not exist: resources/ios/icon/icon-40#3x.png
Looks like the relative path is in reference to the config.xml. If the resources folder exists inside of 'www', then you may need to update the relative path.
I was able to resolve this by updating the relative path to "www/resources/...".
It's likely that your resources haven't been run.
Run:
npm i -g cordova-ionic platform rm ios
ionic platform rm ios // You want to do this just so when you recreate you have necessary resouces
ionic cordova resources
ionic cordova build --release <ios/android>
There should be more answers with this solution, since ionic is a project based on npm and this command will install the necessary libraries.
I used the no brain way, but it works. I added the ressources temporarily with the name they ask for.
Like I copy and past an image icon-20 copy.png then rename it into my needed ressources like icon-small#2x.png
use
ionic cordova resources --icon
if permission required use sudo
sudo ionic cordova resources --icon
it will Generated 28 resources for iOS and Generated 6 resources for Android.
make sure you add:
xmlns:cdv="http://cordova.apache.org/ns/1.0
to the widget section(on the very top) of your config.xml
This will add all necessary Cordova components.

Resources