Does Google AdMob Require Info.plist exactly? - ios

I am trying to set up Google AdMobs on a project that I have already set Firebase up in. I have been trying to follow the Update your info.plist section of the AdMob documentation here: https://developers.google.com/admob/ios/quick-start#swift
but I keep getting the "reason: 'The Google Mobile Ads SDK was initialized without an application ID. Google AdMob publishers, follow instructions at https://googlemobileadssdk.page.link/admob-ios-update-plist to set a valid application ID. Google Ad Manager publishers, follow instructions at https://googlemobileadssdk.page.link/ad-manager-ios-update-plist." Error.
I am wondering if it is because my plist is named GoogleService-Info.plist rather than Info.plist (This is the name given by default when I first began using Firebase). If I try to rename the file to just Info.plist, the firestore part of my project breaks. Does AdMob require Info.plist to be named exactly that?

I found that it does matter what plist I add Google AdMob to. XCode 13 got rid of the Info.plist but you can manually create an info.plist by following this guide: https://betterprogramming.pub/info-plist-is-missing-in-xcode-13-heres-how-to-get-it-back-1a7abf3e2514
Pasting to info.plist solved the issue for me.

I would recommend you to dig more about Info.plist. See this official docs and this medium blog.
First, Info.plist and GoogleService-Info.plist are used for different purposes. If you rename those files some of the service will break surely.
Second, Even if XCode 13, there is Info.plist(though you can't see in project navigator for fresh project). See this medium blog how to configure Info.plist for XCode 13

Related

Expo Ios Build Does Not Contain Valid Info.plist?

I have built a react native project with expo. Whenever I drag the finished .app file into my xcode window I get this error.
How would I go about fixing this?
We will need more info about your app to really help with this. As you are using Expo, you have no direct access to the Info.plist file for iOS. That would have to be maneuvered using the app.json.
You would need a specific configuration property based on what exactly is believed to be requiring a "Valid Info.plist" the message says.
See Expo's documentation on this here: app.json

Where should I add GOOGLE_ANALYTICS_REGISTRATION_WITH_AD_NETWORK_ENABLED?

I'm reading Firebase release notes and it seems that after version 6.29.0 they've adapted to the new iOS 14 tracking requirements and they offer a way to not automatically initialize SKAdNetwork:
[SKAdNetwork registerAppForAdNetworkAttribution] is now automatically called on first open by default. To opt-out of this default behavior, add the key GOOGLE_ANALYTICS_REGISTRATION_WITH_AD_NETWORK_ENABLED with Boolean value NO to your app’s Info.plist file.
I want to trigger SKAdNetwork myself, but it's unclear to me if by app's Info.plist they mean:
Option 1: The Info.plist created when you do Xcode, File, New, Project (the one that contains URLTypes, App Schemes, ...)
Option 2: GoogleService-Info.plist
I think they mean option 1, but I'm not totally sure as everything in Firebase is usually configured by option 2.
It's Option 1.
The GoogleService-Info.plist is supposed to be unused unmodified from the Firebase console download and is backend configuration information.
The app's Info.plist is for app specific configurations.

The app's Info.plist file should contain a NSBluetoothAlwaysUsageDescription key while the key is in the plist file

First of all, I would like to state that I already looked at Stack Overflow post here and adding either the one mentioned by either iCoder & Deepak didn't solve the problem for me.
I'm using React-Native to develop my apps including this React-Native-Permissions package I found. Their documentation states that I should add all the permission their package enables e.g. Location, Camera and all the others mentioned there. After I did this I was able to upload my application to the store and submit it for review.
Today I got to the office and I saw there was some feedback from Apple available. So after I completed the feedback I wanted to re-upload to the store again (increasing the build number as I'm supposed to do).
And now I keep getting the message in the title mentioned above while I have it present in my info.plist like such
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes the react-native-permissions library, which references this permission in its code.</string>
EDIT:
I hope to clarify things below in order to find an answer to the problem I'm facing. The error given in the title occurs directly after uploading to the store (So I'm guessing the actual error is picked up the automatic checks done by the system).
The answer below won't help me to fix the problem since the more descriptive string wont be checked by the automatic system check. And I've successfully used this string for other elements in the info.plist. Next to this I found evidence that people successfully submit their app to the app store using this tactic. As shown by the comment of Gradner following this link React Native Permission issue 266
If you are not using Bluetooth,
just add this to your Info.plist file:
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes the react-native-permissions library, which references this permission in its code.</string>
Apple deprecated NSBluetoothPeripheralUsageDescription property in favor of NSBluetoothAlwaysUsageDescription.
See details here:
link to Apple docs
If you are using bluetooth,
just add this to your Info.plist file:
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app uses bluetooth to find, connect and transfer data between different devices</string>
Someone posted an answer that helped me, but then deleted it! To paraphrase the answer:
Adding the privacy keys to the plist without knowing what is triggering the error from Apple is not the best way to solve this.
In my case, when I did a grep search I found that there is some reference to CoreBluetooth.framework inside my project.pbxproj. I removed the reference and the build and TestFlight upload succeeded!
To search use the following command:
grep -r -a CoreBluetooth.framework ProjectFolder
I got the root cause
We have below two default options in plist to enter the bluetooth usage.
1.Privacy - Bluetooth Peripheral Usage Description
2.Privacy - Bluetooth Always Usage Description
But Xcode save this option in the source code like the below
1.NSBluetoothPeripheralUsageDescription instead of Privacy - Bluetooth Peripheral Usage Description
2.Privacy - Bluetooth Always Usage Description instead of Privacy - Bluetooth Always Usage Description
So now the point is
NSBluetoothPeripheralUsageDescription is deprecated and its expecting the key "NSBluetoothAlwaysUsageDescription"
Here is the solution, open the plist file as source code in Xcode and
copy-paste the below key-value pair
Key: NSBluetoothAlwaysUsageDescription Value: This application
requires bluetooth in order to bla bla bla.
I can't figure out why the first time it wasn't working but when I got into the office today I saw the comment posted by Sumeet.Jain that suggested I should replace the
NSBluetoothPeripheralUsageDescription key with the NSBluetoothAlwaysUsageDescription key
This would actually result in an error that would say missing NSBluetoothPeripheralUsageDescription as we might expect it to. So then I re-added the NSBluetoothPeripheralUsageDescription to my info.plist and now I was finally able to upload my app to the store. Thanks for everyone that helped me.
p.s. The only thing I can think of I did differently compared to yesterday is that I now added the key using Xcode instead of just editing the info.plist file in my editor I use for react-native. Hopefully this helps others as it helped me
Well, I fixed this issues.
if your app is using bluetooth so you must add this into info.plist.
NSBluetoothAlwaysUsageDescription
Our app uses bluetooth to ...do something...
if your app doesn't need bluetooth but it's prompted with unexpectedly.
then:
open Xcode :
go to remove CoreBluetooth.framework:
-> yourproject -> frameworks -> CoreBluetooth.framework
-> yourproject -> Build Phases -> Type Search to find "Bluetooth" (remove all related "Bluetooth")
It's works for me!
Hope will help you.
I was able to successfully remove the Bluetooth permission alert when the app opens. In my case the problem was with the library "react-native-connectivity-status". I downgraded the library from version "1.5.2" to "1.5.1".
Here are the steps:
Change
"react-native-connectivity-status": "^1.5.1",
To
"react-native-connectivity-status": "1.5.1",
Then ran following commands:
rm -rf node_modules/
rm package-lock.json
npm i
cd ios/
rm -rf Pods/
pod install
For deployment targets earlier than iOS 13, add both NSBluetoothAlwaysUsageDescription and NSBluetoothPeripheralUsageDescription to your app’s Information Property List file
String depends upon you if you are using Bluetooth or not.
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes some library, which references this permission in its code.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes some library, which references this permission in its code.</string>

Crash when adding AdMob to Firebase project

I've got an iOS project using Firebase, it's working fine. However, when I try to add AdMob, the app crashes when launching:
"'GADInvalidInitializationException', reason: 'The Google Mobile Ads
SDK was initialized incorrectly. Google AdMob publishers should follow
instructions here:
https://googlemobileadssdk.page.link/admob-ios-update-plist to include
the AppMeasurement framework, set the -ObjC linker flag, and set
GADApplicationIdentifier with a valid App ID. Google Ad Manager
publishers should follow instructions here:
https://googlemobileadssdk.page.link/ad-manager-ios-update-plist'"
Just by adding pod 'Firebase/AdMob' to the Podfile already produces this crash.
Then I added GADApplicationIdentifier to the GoogleService-Info.plist:
<key>GADApplicationIdentifier</key>
<string>APP_KEY</string>
Same thing, crash.
The app is linked to Firebase in the AdMob app site.
Anybody has any tips on this? Google's docs don't seem to be up to date, making a lot of confusion about AdMob implementation with/without Firebase.
Update the app's Info.plist - the file set in the INFOPLIST_FILE Build Setting - not GoogleService-Info.plist.
Info.plist add following line not GoogleService-Info.plist.
<key>GADIsAdManagerApp</key>
<true/>
also add key of Google Ads Mob
<key>GADApplicationIdentifier</key>
<string>key-value</string>

Could not configure Firebase InstanceID

hi I'm trying to include firebase in my app and followed the documentation, when I'm trying to do google sign in, Could not configure Firebase InstanceID error occurs .please advice how to overcome this error
There are two things to check (and hopefully, one will fix it for you):
Make sure your BundleIdentifier is exactly the same in your Firebase project as it is in your Xcode, i.e. com.[yourcompany].[yourappname]
Make sure you got the latest GoogleService-Info.plist file. Go to Firebase Console -> Settings -> Your Application - there will be a blue button to the right that lets you download new configuration file
That solved it for me.
Bug Details
As of version 3.13.0, there appears to be a bug in the Firebase/Core SDK.
I added a symbolic breakpoint at -[FIRInstanceID(FIRApp) configureInstanceIDWithOptions:app:] and stepped though the assembly.
It appears that FIRApp.configure() is ignoring the IS_GCM_ENABLED flag in the GoogleServices-Info.plist and tries to configure GCM regardless of the flag's state. In my case, because my project does not use GCM, the app would crash because there was no GCM_SENDER_ID in the plist.
Workaround
Add a dummy value (i.e. 123456789012) for GCM_SENDER_ID within the GoogleService-Info.plist file. This will allow the application to configure successfully.
You have to add your project which is created on
https://developers.google.com/mobile/add?platform=ios or fire base console into your Firebase dashboard.
Now you can download GoogleService-Info.plist from Firebase and import into your project.
I setup Firebase in code using FIROptions. In my case, I was missing gcmSenderID, fixing it then it works
Firebase DevRel here. This should be an error, unless you enabled gcm, you shouldn't go through instanceid setup. Filed internally.
For now, the workaround is manually changing "IS_GCM_ENABLED" to "NO" in your "GoogleService-Info.plist" file
I was getting this error as I didn't have my GoogleService-Info.plist in my Test folder as well. ( if you are using TDD)
As of the latest Firebase Core 3.16.0 - I seem to need to include it in my main project as well as copying a version into my Test Root.
This also happens when you shift your google SDK integration from one account to another and don't edit the API keys on application side.Make sure when you shift from one google account to another, you re-visit all the SDK guides again like FCM, Google Sign-in etc and make sure you are using new API keys (client_id, URI Scheme) in application.

Resources