AppMonitor is a dynamic framework for ios which moniters your application for the app lunch count and spent time by the user.
- iOS 8.0+
- Xcode 6.0+
- If you need help, use Stack Overflow. (Tag 'appmonitor')
- If you'd like to ask a general question, use Stack Overflow.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
You can install AppMonitor to your projects in two ways
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsTo integrate AppMonitor into your Xcode project using CocoaPods, specify it in your Podfile:
platform :ios, '8.0'
use_frameworks!
target '<Your Target Name>' do
pod 'AppMonitor', '~> 1.8'
endFor Manual integration follow below steps
2. Drag and drop framework to your Xcode project .In the displayed dialog, choose Create groups for any added folders and select Copy items into destination group's folder. This will copy framework to your project folder.
3. Add AppMonitor framework to the embeded framework section of your Xcode project (Target -> General Tab -> Embeded Binaries
You are done.
SDK should be initialised before invoking any APIs available in the framewok.
#import <AppMonitor/AppMonitor.h>
[AppMonitor initializeWithAPIKey:<YOUR_API_KEY>];You can post events with name and attributes.
[AppMonitor postEvent:@"Test" withAttributes:@[@"arg1",@"arg2"]];This API will returns the app lunch count till that time . It will be returning an NSInteger.
NSInteger appLaunchCount = [AppMonitor appLaunchCount]This API will returns the spent time of user in the application till that time . It will be returning an NSTimeInterval.
NSTimeInterval appSpentTime = [AppMonitor appSpentTime];This API can be used to change the log level from deafult AppMonitorLogLevelMinimal.
[AppMonitor setLogLevel:AppMonitorLogLevelAllLogs];1.After manual integration if your are getting below error
dyld: Library not loaded: @rpath/AppMonitor.framework/AppMonitor Referenced from: /Users/rahul/Library/Developer/CoreSimulator/Devices/2BDC82C0-4F17-4CEB-A5B7-363EC49DB4FE/data/Containers/Bundle/Application/476ABE1D-7E7C-41D5-BEAA-EAE3B5623E23/Test.app/Test Reason: image not found
This means you haven't followed the manual integration steps.But don't worry adding AppMonitor framework in emebeded binaries section of your Xcode project will fix this issue.
2.If you are getting Invalid API key error
2016-11-09 20:20:50.762 Test[2851:1610829] AppMonitor::INVALID API KEY 2016-11-09 20:20:50.867 Test[2851:1610829] *** Terminating app due to uncaught exception of class'__NSCFConstantString' libc++abi.dylib: terminating with uncaught exception of type __NSCFConstantString (lldb)
3.If you are SDK not initialied error
2016-11-09 20:33:13.769 SampleApp[3142:1671162] AppMonitor::SDK NOT INIATIALIZED
Check the license file
