Posts tagged with swift

I am trying to implement App Tracking Transparency in my app. I tried to do this on first ViewControllor, but it crashes the app after uploading to the test flight.

After this, I found a lot of info that this should be done in appDelegate I did this way. Of course, I have set NSUserTrackingUsageDescription in Info.plist

I tried to figure it out with this post.

In the debugger, I always see "Not Determined". Could anyone please help with this?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         // Override point for customization after application launch.         requestTrackingPermission()         GADMobileAds.sharedInstance().start(completionHandler: nil)         return true     } 

The function

func requestTrackingPermission() {       if #available(iOS 14, *) {         // ATTrackingManager.requestTrackingAuthorization { status in         ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in           switch status {           case .authorized:             // Tracking authorization dialog was shown             // and we are authorized             print("Authorized")                           // Now that we are authorized we can get the IDFA             print(ASIdentifierManager.shared().advertisingIdentifier)                          case .denied:             // Tracking authorization dialog was             // shown and permission is denied             print("Denied")           case .notDetermined:             // Tracking authorization dialog has not been shown             print("Not Determined")           case .restricted:             print("Restricted")           @unknown default:             print("Unknown")           }         }       )}     } 

In podfile.lock I have:

  • Google-Mobile-Ads-SDK (8.7.0):
    • GoogleAppMeasurement (< 9.0, >= 7.0)
    • GoogleUserMessagingPlatform (>= 1.1)

This code works fine, so the SDK installed successfully.

import GoogleMobileAds  let options = GADMultipleAdsAdLoaderOptions()  options.numberOfAds = 5  adLoader = GADAdLoader(adUnitID: adUnitID, rootViewController: requester, adTypes: [.native], options: [options])  adLoader.delegate = self 

But I can display the received GADNativeAd, because views are unaccessible.

import UIKit import GoogleMobileAds class FeedAdTVC: UITableViewCell {     func setup(with: GADNativeAd) {         let templateView = GADUnifiedNativeAdView()     } } 

I got: Cannot find 'GADUnifiedNativeAdView' in scope

we market our App via App Install campaigns via Google Ads. Now we would like to be able to detect within our iOS (and later Android) app that a user is coming from a certain ad campaign, so we can display related content (e.g. a coupon code for all those coming from Google Ad). However, here we are faced with the challenge to recognize within the app after the installation whether the user comes from that Google Ad campaign. We have integrated the Firbase SDK, but I have not found any references here. A Campaign Link from Apple only provides the install in App Analytics, but I cannot access it in the app. What I had found so far was the following documentation: https://developers.google.com/analytics/devguides/collection/ios/v3/campaigns and some tips on how to track the campaign via GAITracker. However, this refers to the outdated Google Analytics SDK and I have already migrated to Firebase anyway. We set up a campaign as follows:

If a user now sees the advertisement and clicks on it, he will be directed to the App Store via the Google Analytics link "click.google-analytics....redirect=... ". Afterwards I would like to see in the AppDelegate if it comes over such a link. Can I take this from the URL, for example? Or is that not possible because it is routed through the App Store?

     func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {         // Get CampaignName or some identifier from the Google Ad         return true     } 

If this is not possible, would using an attribution service like Adjust or Branch.io be the solution to make this possible? What would be the flow when using such a service?

Many thanks in advance for appropriate help!

Does anyone know why GoogleMobileAds still has UIWebView in it? I installed the latest version of GoogleMobileAds (7.60.0) but when I run grep -r UIWebView Pods/ it detects that GoogleMobileAds has UIWebView

If I read the documentation here that GoogleMobileAds has removed all references to UIWebView since version 7.55.0 then why it still appear?

I've tried to reinstall, pod deintegrate, pod update but it still has UIWebView

My Apps gets crash with following Crashlytics console description:

Fatal Exception: UIApplicationInvalidInterfaceOrientation

Supported orientations has no common orientation with the application, and [GADFullScreenAdViewController shouldAutorotate] is returning YES

App supports all orientations except when a user switches player in fullscreen mode. I use a method in AppDelegate to manage supported orientations:

var supportedOrientation = UIInterfaceOrientationMask.all func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {    return self.supportedOrientation }