App Invite configuration failed Firebase iOS cocoapods - ios

I got a build error with this in it while trying out the new version of firebase
*** Terminating app due to uncaught exception 'com.firebase.appinvite', reason: 'App Invite configuration failed.'

Click on your project
Navigate to Info tab
Scroll down you will see the URL Types
Click the + button and add your bundleID to URL Schemes
Click the + button again and add your REVERSED_CLIENT_ID to URL Schemes. This can be found in your GoogleService-Info.plist
Finally your URL types should look something like this

The Invites pod does require setting up a couple of custom URL schemes, which is easy to skip over. You can do this in you Info.plist, or in the General tab of the target in Xcode. The two custom URL schemes are:
Your bundle ID. e.g. "com.foo.bar"
Your Google Sign In client ID with the components reversed. e.g. "com.googleusercontent.apps.12345678-xxxxxxxxx".
The second one is trickier! In the GoogleService-Info.plist you downloaded there should be a key REVERSED_CLIENT_ID you can copy the value of. For what its worth, I find that the first build after I edit the custom URL types doesn't seem to register it properly, so if it doesn't work right away, just try again.

My podfile had the following. I just had to uncomment the Firebase/Invites pod. There seems to be a problem with it for now.
pod 'Firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Analytics'
pod 'Firebase/AppIndexing'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/DynamicLinks'
#pod 'Firebase/Invites' this caused an exception!!
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'

Firebase Invites works over Firebase Dynamic Links so, by following the Dynamic Links guide, you need to setup 2 things in your project:
Add Url type
At Target settings, info tab, add the new url. Set the schema your bundle ID. If you use other schema you have to set it on Dynamic Links page at Firebase console.
Associate the Firebase Dynamic link domain in your app.
Go to Firebase console and copy from Dynamic links section the
Firebase-generated Dynamic Link Domain of your app.
Go to target settings, capability tab, and enable Associated Domains.
Add the Firebase-generated Dynamic Link Domain you just copied.
This should fix the configuration error as it did in my case. Anyway i advise to read the full guide.

Related

SKAdNetwork using Firebase SDK and Firebase Analytics

I am looking to integrate Firebase Analytics SDK into my apps, to be able to link with Google Ads so we can track ad campaign and attribution. Since our apps target kids space, we are not allowed to use any IDFA capabilities by Apple, so using anything like AdSupport.framework or ATT (App Tracking Transparency) it will risk app rejection. So, that leaves SKAdNework. According to Firebase Notes (https://firebase.google.com/support/release-notes/ios#version_6290_-_july_28_2020), SKAdNetwork will register for AdNetwork attribution automatically called on first open by default, and by setting the following key GOOGLE_ANALYTICS_REGISTRATION_WITH_AD_NETWORK_ENABLED YES in our Info.plist file, should opt in to this default behaviour. However, I have no way to verify this on device (i.e. I see no console message on the device, nor can't find this call in the code [SKAdNetwork registerAppForAdNetworkAttribution])
Is there anything else I am missing? Do I need to add SKAdNetwork Identifiers to my plist file, like this (https://developers.google.com/admob/ios/ios14#skadnetwork)?
Bellow is a sample copy of my pod file:
target 'UnityFramework' do
pod 'Firebase/AnalyticsWithoutAdIdSupport', '8.6.0'
pod 'Firebase/DynamicLinks', '8.6.0'
pod 'Firebase/InAppMessaging'
pod 'Firebase/Messaging', '8.6.0'
pod 'Firebase/RemoteConfig', '8.6.0'
end

iOS app rejected - Guideline 5.1.2 - Legal - Privacy - Data Use and Sharing. "create a unique identifier for the user's device"

"We found in our review that your app collects user and device information to create a unique identifier for the user's device. Apps that fingerprint the user's device in this way are in violation of the Apple Developer Program License Agreement and are not appropriate for the App Store.
Specifically, your app uses algorithmically converted device and usage data to create unique identifier in order track the user. The device information collected by your app may include some of the following: defaultManager, NSLocaleCollationIdentifier, NSLocaleQuotationBeginDelimiterKey, NSLocaleCurrencySymbol, and NSLocaleExemplarCharacterSet."
I don't know how to resolve this issue. I store "UIDevice.current.identifierForVendor?.uuidString" and "UUID().uuidString" in UserDefaults and Keychain, then send them to server.
parts of Podfile
pod 'AppAuth', '1.2.0'
pod 'Firebase/Core', '7.5.0'
pod 'Firebase/Messaging', '7.5.0'
pod 'Firebase/RemoteConfig', '7.5.0'
pod 'Firebase/Performance', '7.5.0'
pod 'Firebase/Analytics', '7.5.0'
pod 'Firebase/Crashlytics', '7.5.0'
pod 'FBSDKCoreKit', '9.0.0'
pod 'FBSDKLoginKit', '9.0.0'
pod 'FBSDKShareKit', '9.0.0'
# Ads
pod 'Google-Mobile-Ads-SDK', '7.69.0'
pod 'FBAudienceNetwork', '6.2.1'
pod 'InMobiSDK/Core', '9.1.1'
pod 'mopub-ios-sdk', '5.15.0'
pod 'Verizon-Ads-StandardEdition', '1.8.1'
# Ads Medation
pod 'GoogleMobileAdsMediationFacebook', '6.2.1.0'
pod 'GoogleMobileAdsMediationInMobi', '9.1.1.0'
pod 'GoogleMobileAdsMediationMoPub', '5.15.0.0'
pod 'GoogleMobileAdsMediationVerizonMedia', '1.8.1.0'
pod 'AppBoxoSDK', '1.3.39'
pod 'SAMKeychain'
Update:
#dfd Thanks, bro. You saved me a lot of time. I changed the App Privacy and privacy policy on appstoreconnect, then the review passed.
It's cause of Adjust SDK. You can refer to this link.
Just to give another hint of how to solve this issue.
Long Story Short
I found out that when I imported Branch with CocoaPods, AdSupport was being dynamically linked to the App for some reason. Switching to Swift Package Manager solved my issue.
I also updated my Privacy Settings as suggested above and I made sure I answered NO to the second section of each section (NO to tracking).
Full Disclosure
IDFA can be used as long as you ask permission to the user . This doesn't prevent a 3rd party from trying to access this identifier (the system will just return 0s). See for instance how Branch handles it, they check at runtime for AdSupport framework.
From my understanding, if they detect this framework is linked (you don't necessarily see it in your project's Frameworks, Libraries, and Embedded Content) they'll reject your App.
In my case, I found out that when I imported Branch with CocoaPods, AdSupport was being linked for some reason. Switching to Swift Package Manager solved my issue. You can check it by using this snippet:
// DO NOT IMPORT AdSupport
if NSClassFromString("ASIdentifierManager") != nil {
print("AdSupport is linked somehow")
}
I also reviewed my Privacy Settings, but this is very particular for every App. In every section, I updated the checkboxes as best as I could and after clicking Next I made sure the second question (referring to tracking) was answered as NO.
Finally, for User ID and Device ID sections, I made sure that Third-Party Advertising and Developer’s Advertising or Marketing were unchecked.

Firebase Class FIRAAppEnvironmentUtil is implemented in both when using Cocoapods

I'm trying to use Firebase inside a dynamic framework (Cocoa Touch Framework). I've added Firebase to the Podfile like so:
platform :ios, '9.0'
use_frameworks!
workspace 'Test.xcworkspace'
target 'Test' do
project 'Test.xcodeproj'
end
target 'TestFramework' do
project 'TestFramework/TestFramework.xcodeproj'
# Pods for TestFramework
pod 'Firebase/Database'
pod 'Firebase/Auth'
end
And I've set a target dependency in the build phase of my Test target. All according to: https://github.com/benasher44/CocoaPodsLibExample
However when I reference my TestFramework from my Test target during app startup I get this message (for all the Firebase classes) in the console:
objc[34978]: Class FIRAAppEnvironmentUtil is implemented in both
/Users/peterwarbo/Library/Developer/Xcode/DerivedData/Test-goxvmnklbfyswhdniydzbvzudcez/Build/Products/Debug-iphonesimulator/TestFramework.framework/TestFramework
(0x1085858c8) and
/Users/peterwarbo/Library/Developer/CoreSimulator/Devices/43080C45-C9E9-4237-A255-5029CC4D5797/data/Containers/Bundle/Application/FCFDC439-8564-40A8-9B34-935FE222193E/Test.app/Test
(0x104342938). One of the two will be used. Which one is undefined.
And the app crashes. I've read that this might have something to do with that Firebase is a static library. I need to solve this so I can use my use Firebase from my different targets. Specifically what I'm trying to achieve is to be able to do Firebase operations from a keyboard extension, so both my host app and my extension should be able to to perform Firebase operations.
I've been trying to solve this for more than a week now and I haven't come up with any working solutions :(
I'm using Xcode 8.2.1, Cocoapods 1.2.0

How to add Firebase to Today Extension iOS

I need to be able to use Firebase in my Today View Extension, however I cannot seem to import the Firebase module. I think it's because I need a new target in my cocoa pods file, but I'm not sure on how to do this.
Thanks.
You have to treat the today extension as its own separate app(somewhat)
in your firebase project dashboard, you need to hit the "Add another app" button.
select iOS and then enter the BUNDLE ID of your TODAY EXTENSION
Complete the wizard and download the generated GoogleService-Info.plist file
Add the plist file to your Today Extension's root folder
go to your xcode project, and manually add FirebaseCore.framework and FirebaseDatabase.framework to your Today Extension
finally inside your today today viewcontroller call FirebaseApp.configure()
import FirebaseDatabase
import FirebaseCore
override func viewDidLoad() {
super.viewDidLoad()
FirebaseApp.configure()
}
Or without adding an extra app at the Firebase console, just re-use your main project's GoogleService-Info.plist with a minor modification (see below). The Firebase app singleton would have to be configured either way in both apps on startup.
To synchronize an extension and the containing app see App Extension Programming Guide: Handling Common Scenarios or this reddit comment. This Stackoverflow thread specifically describes this scenario.
Steps:
Copy the containing app's GoogleService-Info.plist into your extension in Xcode
Drag the copied GoogleService-Info.plist into Xcode into your share extension and
Change the BUNDLE_ID to the name of your share extension's target
Add new target to your Podfile
Install dependencies (pod install)
Configure the Firebase application object in your extension
Step 1. Copy the containing app's GoogleService-Info.plist into your extension in Xcode
Step 2. Drag the copied GoogleService-Info.plist into Xcode into your share extension and
Step 3. Change the BUNDLE_ID to the name of your share extension's target
For us the main (i.e., containing app) is Access News and the share extension is Access-News-Uploader.
Step 4. Add new target to your Podfile
# ...
target 'name-of-your-extension' do
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Auth'
# etc.
end
Entire Podfile of our project.
Step 5. Install dependencies (pod install)
Step 6. Configure the Firebase application object in your extension
/* 1. Import Firebase */
/**********************/
import Firebase
/**********************/
class WhereverInYourExtension: WhateverController {
// ...
override func viewDidLoad() {
super.viewDidLoad()
/* 2. Configure Firebase */
/*************************/
if FirebaseApp.app() == nil {
FirebaseApp.configure()
}
/*************************/
// ...
}
Pod issue fixes
1) Still unable to import Firebase!
Make sure that pods are installed for all targets in your project. To achieve this use inherit! or abstract_target in your Podfile.
The simplest example using abstract_target from the official documentation:
abstract_target 'Networking' do
pod 'AlamoFire'
target 'Networking App 1'
target 'Networking App 2'
end
For inherit!, see this SO question and answer.
2) How do I achieve this on my existing app without messing things up?
Remove Podfile, Podfile.lock and YourProject.xcworkspace
Issue pod init and it will list your existing targets one by one.
Edit the Podfile by either grouping under abstract_target or using inherit!
Issue pod install
A new YourProject.xcworkspace file will be generated, and if you open the your project using this, under General > Linked Frameworks and Libraries it will show that Firebase is added and can be imported from project files.
(See this SO thread for a concrete example where this clean-up method needed to be used.)
3) firebase 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
This is what worked for me:
wiped everything clean by cloning our project repo fresh from Github,
deleted
~/Library/Developer/Xcode/DerivedData
./Pods/
Podfile
Podfile.lock
Issue pod init on the console
Recreate Podfile (basically copy-paste)
Issue pod update on the console
(Probably won't work next time.)
To my knowledge widgets are not allowed to use certain api's such as firebase. Widgets are supposed to show data provided by the main application via UserDefaults e.g.
TodayViewExtensions (or widgets) may only be very light codewise.

Integrating Parse in App extension

I’m trying to implement parse functionality in a app extension. The main app uses Parse to push and retrieve data. The problem is I can't install the parse SDK to my app extension. Is this even possible? I've been on google for about three hours and I’m starting to think not. I've tried to init another pod file and I’ve tried the the abstract_target function. No matter what I do, I can't seem to import it. Has anyone achieved this before? Im using swift 2.0 if that helps.
If there is another way to carry out the following, please let me know:
(This happens in the share popup view)
1.Grab user input text
2.Push it to the parse backend
in order to use Parse ios SDK in your app extension you are require to do the following:
enable local data store (local data store is where your data is being saved locally on your device)
Enable app groups and keychain sharing in both of your targets (your main app and your extension) this allows you to share the data and the session between your app and your extension.
When i did it. I follow this guide which explain how to integrate apple watch and app extension with parse IOS SDK.
If you are using CocoaPods in your project please make sure that you load the Parse pod also to your extension..
so let's assume that the only pod that you have in your Podfile is pod 'Parse' you Podfile should look like the following
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
def my_pods
pod 'Parse'
end
# Change the MainAppTargetName to your main app target
target 'MainAppTargetName' do
my_pods
end
# change MyExtensionTargetName to your extension target name
target 'MyExtensionTargetName' do
my_pods
end

Resources