VIEventTracker 0.1

VIEventTracker 0.1

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • Vito Zhang

A simple way to handle special event at special time.

TrackDemo.gif

How to use

Anywhere you want use VIEventTracker, simply add #import "VIEventTracker.h"

Track an event with a call back handler

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"];
    }
}];

Stop track event

[VIEventTracker stopTrackEvent:@"test"];

Call this method will untrack the Event, that means the handler for the event will never be called.


More

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.

License

VIEventTracker is available under the MIT license. See the LICENSE file for more info.