Cricket is an iOS library for sending feedback directly from within the app. It grabs a screenshot, some feedback and sends the data to wherever you want (see overview below for details).
In your app delegate:
#import <NPCricket/NPCricket.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[NPCricket useEmailComposerWithToEmailAddress:@"[email protected]"];
// ... your code here ...
return YES;
}
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (motion == UIEventSubtypeMotionShake) {
[NPCricket show];
}
}
Cricket does not show itself automatically. Instead, you must call [NPCricket show]
yourself. One example would be to show it when the user shakes their phone (see the example above).
Cricket is designed to be extensible by relying on "handlers" to process the feedback. Any class can become a handler by conforming to the NPCricketHandler
protocol. This way you could for example send the feedback directly to your server via a custom API.
For your convenience I've included a handler for using the built-in email composer (NPEmailComposerHandler
)
If you want to create your own handler simply create a class that conforms to NPCricketHandler
and implement the single method, like so:
#import "NPCricketHandlerProtocol.h"
@interface MyCustomHandler : NSObject <NPCricketHandler>
@end
@implementation MyCustomHandler
- (void)NPCricket_handleFeedback:(NPFeedback *)feedback {
// Do something with the feedback ...
}
@end
Then you simply tell NPCricket
to use it, like so:
MyCustomHandler *myCustomHandler = [[MyCustomHandler alloc] init];
[NPCricket useHandler:myCustomHandler];
Cricket requires iOS 8.0 and above.
NPCricket is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "NPCricket"
Nebojsa Petrovic, [email protected]
NPCricket is available under the MIT license. See the LICENSE file for more info.