swiftibm-mobilefirstxcode7mobilefirst-analytics

MobileFirst Platform Operational Analytics in Native iOS Swift applications


I'm developing a native iOS MobileFirst application in XCode 7 (Swift) and MobileFirst 7.0.

I want to use MobileFirst Operational Analytics and I'm following this guidelines:

[https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/moving-production/operational-analytics/][1]

I have some questions:


Solution

  • Answering 1)

    I realized that I wasn't connecting successfully to the MobileFirst server. Once I successfully connect the sessions were recorded automatically by the the MobileFirst Operatinal Analytics tool. The code is:

    let connectListener = MyConnectListener()
    WLClient.sharedInstance().wlConnectWithDelegate(connectListener)
    

    Answering 2)

    When invoking the adapters in this way, the Mobilefirst Operational Analytics does not collect the information for the pie charts, it registers this calls as http calls:

    let request = WLResourceRequest(URL: NSURL!, method: String!)
    

    You have to invoke the adapters like this so that the pie charts are automatically generated:

    let myInvocationData = WLProcedureInvocationData(adapterName: String!, procedureName: String!)  
    

    Answering 3)

    Using the following code in swift analytics were successfully send to the server.

    let doAnaylitics = WLAnalytics.sharedInstance()
    doAnaylitics.enable()
    doAnaylitics.log("type", withMetadata:["location":location])
    doAnaylitics.send()
    doAnaylitics.disable();