iOS Development

ios – Sort ‘Analytics’ has no member ‘logEvent’ Xcode

Spread the love


Had an issue, when tried to implement Analytics into my challenge on Xcode:

Analytics.logEvent(AnalyticsEventSelectContent, parameters: [
    AnalyticsParameterItemID: "id-(testTitle)",
    AnalyticsParameterItemName: testTitle,
    AnalyticsParameterContentType: "cont",
])

Error: Can not discover 'Analytics' in scope and Can not discover 'AnalyticsParameterItemName' in scope.

Script:
import FirebaseStorage

class mainScreenScript: UIViewController
{

override func viewDidLoad()
    {
        tremendous.viewDidLoad()

        let testTitle = "TestContentTitle"

        Analytics.logEvent(AnalyticsEventSelectContent, parameters: [
            AnalyticsParameterItemID: "id-(testTitle)",
            AnalyticsParameterItemName: testTitle,
            AnalyticsParameterContentType: "cont",
        ])
    }
}

My pods had been:

platform :ios, '13.0'

goal '(myAppName)' do
  use_frameworks!

  # Pods for (myAppName)
  
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'
  pod 'FirebaseUI'
  pod 'FirebaseAnalytics'
  pod 'FirebaseUI/E-mail'
  pod 'Firebase/Storage', '~> 8.0'
  pod 'GoogleUtilities/UserDefaults'
  pod 'Charts'
  pod 'IQKeyboardManagerSwift'
  pod 'CryptoSwift'
  pod 'Firebase/MLModelDownloader'
  pod 'TensorFlowLiteSwift'
  pod 'GoogleSignIn'
  pod 'FBSDKLoginKit'
  pod 'FBSDKCoreKit'
  pod 'Google-Cellular-Advertisements-SDK'
  pod 'SideMenu'
  pod "MBCircularProgressBar"
  pod 'DGCharts' 


finish


post_install do |installer|
    installer.generated_projects.every do |challenge|
          challenge.targets.every do |goal|
              goal.build_configurations.every do |config|
                  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
               finish
          finish
   finish
finish

AppDelegate:

import Firebase
import FirebaseFirestore
import FirebaseAuthUI
import FirebaseStorage

and

func utility(_ utility: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
    FirebaseApp.configure()
    let db = Firestore.firestore()
    
    //different components of the code
    
    ApplicationDelegate.shared.utility(utility, didFinishLaunchingWithOptions: launchOptions)
    
    return true
}

2 thoughts on “ios – Sort ‘Analytics’ has no member ‘logEvent’ Xcode

  1. I’ve been online for more than three hours now, and I haven’t found any articles as fascinating as yours. I think it’s worth it enough. If more bloggers and website owners created content as good as yours, the internet would be far more useful than it already is.

Leave a Reply

Your email address will not be published. Required fields are marked *