how to integrate flurry in ios using swift language

后端 未结 4 1601
走了就别回头了
走了就别回头了 2021-01-18 10:32

I want to integrate flurry in ios using swift language. I added the flurry sdk\'s two files : flurrylib.a and flurry.h and then entered my api key in project TestProject4-Br

4条回答
  •  清酒与你
    2021-01-18 11:09

    I had the same issue and adding a bridging header worked for me. Here are the steps I followed.

    Note: If you already have a bridging file, skip the steps 2 to 4

    1. I dragged the Flurry folder to my Swift iOS project in XCode.
    2. I created a bridging header file by creating a new Objective-C header file (in XCode menu it's File/New/File/iOS/Source/Header File)
    3. I called the file name "PROJECTNAME-Bridging-Header.h" (replace PROJECTNAME with your XCode project name)
    4. In Project Build Settings, I searched for "Swift Compile - Code Generation" and there in "Objective-C Bridging Header" I entered the name of my new bridging file (PROJECTNAME-Bridging-Header.h) for debug and release values.
    5. Now, back in my bridging header file, I referenced the Flurry header file.

      #import "Flurry.h"

    6. In my AppDelegate.swift file, I could then call the Flurry methods using Swift:

      func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // setup Flurry Flurry.startSession(flurryKey) // replace flurryKey with your own key Flurry.setCrashReportingEnabled(true) // records app crashing in Flurry Flurry.logEvent("Start Application") // Example of even logging

    Hope it helps someone.

提交回复
热议问题