solution
- add
#import "mobclick.h"
to yourBridging-Header.h
- drag these files into file navigator
libMobClickLibrary.a
MobClick.h
- in
Build Phases
underLink Binary With Libraries
- add
libz.dylib
- add
- add code to your
application didFinishLaunchWithOptions
MobClick.startWithAppkey("app_key", reportPolicy: BATCH, channelId: "")
MobClick.setAppVersion(getAppVersion())
-
add code to your view file
override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) MobClick.beginLogPageView("view_01") } override func viewWillDisappear(animated: Bool) { super.viewWillDisappear(animated) MobClick.endLogPageView("view_01") }
getAppVersion()
func getAppVersion() -> String {
let dictionary = NSBundle.mainBundle().infoDictionary!
let version = dictionary["CFBundleShortVersionString"] as String
let build = dictionary["CFBundleVersion"] as String
return "\(version).\(build)"
}