In-app feedback for Cocoa apps
In-app feedback allows you to include feedback, attach and annotate images/screenshots, include logs and diagnostics, and report a bug. Before you start integrating In-app Feedback, make sure that you have already integrated Apptics with your app.
Installation
Copiedsource 'https://github.com/CocoaPods/Specs.git'
target '[TARGET NAME]' do
pod 'AppticsFeedbackKitSwift'
end
Import
Copied#import <AppticsFeedbackKit/AppticsFeedbackKit.h>
Copiedimport AppticsFeedbackKit
Invoke the feedback screen
- To present the feedback screen to the users, call the below method.
- To present help me the screen to the users, call the below method.
Shake for Feedback
Enable shake-to-feedback to allow users to share their feedback just by shaking their device.
- To start monitoring the shake gestures, use the below.
Copied[FeedbackKit startMonitoringWithShake:YES maxToleranceLimit:<#NSInteger#>];
CopiedFeedbackKit.startMonitoringWithShake(true, maxToleranceLimit: <#NSInteger#>)
- You can also enable shake-to-feedback during initialization.
Copied- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions {
[Apptics initializeWithVerbose:YES];
[FeedbackKit startMonitoringWithShake:YES maxToleranceLimit:<#NSInteger#>];
return YES;
}
Copiedfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Apptics.initialize(withVerbose: <#T##Bool#>)
FeedbackKit.startMonitoring(withShake: <#T##Bool#>, maxToleranceLimit: <#T##Int#>)
return true
}
Configuration and settings
- Anonymous user alert: Set the below method to true to enable an alert message when a user is in anonymous mode. If you set it to false user won't be notified with the anonymous alert message.
Copied[FeedbackKit enableAnonymousUserAlert:YES];
- Toggle feedback features: To enable/disable the features of the feedback system from the apps setting screen, call the below method.
Copied[FeedbackKit enableMonitoringShake:YES];
- Get monitoring status: To get the monitoring status, call the below method.
Copied[FeedbackKit monitoringStatusOfShake];
- Mask text in screenshots: Set the below method to true to mask the detected text in a screenshot. If you set it to false, the text won't be masked automatically. The user will have to tap on the individual items to mask them or by tapping on mask-all / unmask-all button
Copied[FeedbackKit setMaskTextByDefault:YES];
- Pre-fill user's email: To prefill the user's email address in the feedback screen, use the below method.
Copied[FeedbackKit setSenderEmailAddress:<#NSString *#>];
The Feedback module is independent of the analytics preference the user sets when they log in for the first time in the app. The user consent (set during the app log-in) is only for the analytics data.
- Support email: Set the support email address to direct the support emails that will be sent from the native email client, if you don't have an email for setFromEmailAddress:
Copied[FeedbackKit setSupportEmailAddress:<#NSString *#>];
- Show info before sending feedback: To show a detailed page (other Info) of what additional information (device info, diagnostic info, and system logs) is shared while the user is trying to share the feedback, call the below method.
Copied[FeedbackKit showInfoBeforeSendingFeedbackToUser:YES];
- Photo library access We access the photo library from our FeedbackKit module so you need to add the description for "NSPhotoLibraryUsageDescription" in the app's Info.plist file with generic purpose string. For eg: This app requires access to the photo library.
CopiedxmlCopy code<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
Callbacks​
FKCustomHandler is the protocol to use to get callbacks related to the f eedback module.
- Create a swift / Obj class in the CustomHandler and extend the protocols to provide implementations of its requirement.​
Copied@interface CustomHandler : NSObject <FKCustomHandler>
@end
Copiedclass CustomHandler: NSObject, FKCustomHandler {
// Implement required methods
}
- You can now pass the instance to the FKCustomHandler class.
Copied[FKCustomHandlerManager setCustomHandler:[CustomHandler new]];
CopiedFKCustomHandlerManager.setCustomHandler(CustomHandler())