TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Custom |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
A simple way to handle special event at special time.
Anywhere you want use VIEventTracker, simply add #import "VIEventTracker.h"
Simple Demo
Track a event with a call back.
[VIEventTracker trackEvent:@"test" handler:^(NSUInteger times) {
NSLog(@"count: %ld", (long)times);
}];
Another demo
Track a event, when this method called 3 times, do something you want.
[VIEventTracker trackEvent:@"test" handler:^(NSUInteger times) {
if (times == 3) {
// Handle some special action when this event tracked 3 times
//......
NSLog("Already track 3 times, cool!!!");
// Stop track the event when you complete track, then this block will never be called.
[VIEventTracker stopTrackEvent:@"test"];
}
}];
[VIEventTracker stopTrackEvent:@"test"];
Call this method will untrack the Event, that means the handler for the event will never be called.
The event tack status will be saved when app enter background. If you want to save the status immediately, you can call [VIEventTracker synchronize];
.
More other API see the VIEventTracker.h
file.
VIEventTracker is available under the MIT license. See the LICENSE file for more info.