iOS SDK
Gives access to all Goodays features for your iOS apps.
The iOS SDK is being depreciated. We strongly advise against integrating it into your mobile application.
Please consult your Goodays contact to explore the possibilities.
The iOS SDK allows you to:
- Open a Store Locator interface
- Or, for a given point of sale :
- Opening a feedback submission interface
- Obtaining the customer relationship score
- Obtaining the satisfaction score
- Display the Store Display
The iOS SDK is only available in Objective-C.
Installation
- Add the Goodays SDK by adding the following line to your
Podfile
.
pod 'Critizr-ios', :git => 'https://github.com/critizr/critizr-ios-pod.git', :tag => '1.2.11'
- Then install it
pod install
- Import headers
Critizr.h
before calling methods on the Goodays SDK:
#import <Critizr/Critizr.h>
- Fill in the Goodays API Key in the
info.plist
file before calling methods on the Goodays SDK:
<key>CritizrAPIKey</key>
<string>Critizr API Key</string>
Fill in the Goodays environment in the info.plist
file before calling methods on the Goodays SDK (don't forget to replace it with your own):
<key>CritizrEnvironement</key>
<string>PreProduction</string> //OR <string>Production</string>
Screenshots
References
Launch interfaces CRFeedbackDialog
or CRFeedbackDialogDelegate
CRFeedbackDialog
or CRFeedbackDialogDelegate
CRFeedbackDialog
CRFeedbackDialog
+ (CRFeedbackDialog *) feedbackDialog
Returns an instance of CRFeedbackDialog
that you can use to launch Goodays interfaces.
[CRFeedbackDialog feedbackDialog];
- (void) presentFeedbackDialogFrom: (UIViewController *)viewController
Launches the Store Locator Interface as a modal, using the UIViewController
indicated. Customers are therefore invited to choose the point of sale to which their feedback should be sent.
[feedbackDialog presentFeedbackDialogFrom:self withParams:NULL];
- (void) presentFeedbackDialogFrom:(UIViewController )viewController WithStoreIdString:(NSString )storeId
Launches the Feedback Submission Interface as a modal, using the UIViewController
indicated, for the storeId
point of sale.
NSString *storeID = @"velo-brest";
[feedbackDialog presentFeedbackDialogFrom:self withStoreIdString:storeID withParams:NULL];
- (void) presentStoreDisplayDialogFrom:(UIViewController )viewController WithStoreIdString:(NSString )storeId
Launches the Store Display Interface as a modal, using the indicated UIViewController
, for the storeId
point of sale.
NSString *storeID = @"velo-brest";
[feedbackDialog presentStoreDisplayDialogFrom:self withStoreIdString:storeID withParams:NULL];
CRFeedbackDialogDelegate
Your UIViewController
can follow the CRFeedbackDialogDelegate
protocol and thus be notified of events that relate to your CRFeedbackDialog
via the following method calls:
- (void) feedbackDialogDidCloseWithMessageSent: (BOOL)messageSent
Method that is called when the feedback submission interface completes. If a comment has been sent by the user during the process, messageSent
will be set to YES
.
Retrieving data : CRSdk
or CRSdkDelegate
CRSdk
or CRSdkDelegate
CRSDK
+ (CRSdk ) critizrSDKInstanceWithAPIKey: (NSString )apiKey andDelegate: (id)delegate;
Returns an instance of CRSdk
that you can use to retrieve data relating to Goodays.
CRSdk *sdk = [CRSdk critizrSDKInstance:self];
- (void) fetchRatingForPlace:(NSString *)aPlaceId withDelegate:(id)aDelegate;
Allows you to retrieve the customer relationship score attributed to a point of sale with ID "<posId>"
. This method is asynchronous, in that, when the customer relationship score is retrieved, the [critizrPlaceRatingFetched
] method of the CRSdkDelegate
is called.
NSString *storeID = @"<posId>";
[sdk fetchRatingForPlace:storeID withDelegate:self];
CRSDKDelegate
Your UIViewController
(or any class) can follow the CRSdkDelegate
protocol in order to be called by the following methods:
- (void)critizrPlaceRatingFetched:(double)customerRelationshipRating withSatisfaction:(double)satisfactionRating
This method is called in response to the fetchRatingForPlace:withDelegate:
method in CRSdk
.
customerRelationshipRating
corresponds to the customer relationship score, and satisfactionRating
corresponds to the satisfaction score of the point of sale you specified.
- (void) critizrPlaceRatingError:(NSError *)anError
Method called in response to the fetchRatingForPlace:withDelegate
: method, in the event that an error occurs.
Practical example
#import "ViewController.h"
#import <Critizr/Critizr.h>
@interface ViewController () <CRSdkDelegate>
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSString *storeID = @"velo-brest";
NSDictionary *params = @{
@"mode" : @"feedback",
@"user" : @"TWljaGFlbHxTY290dHxtaWNoYWVsLnNjb3R0QGR1bmRlcm1pZmZsaW4uY29tfDAxMjM0NTY3ODl8MTIzQUJD"
// The user value corresponds to this string encoded in base64: Michael|Scott|[email protected]|0123456789|123ABC encodé en BASE64
};
// Collect part
// Launch a modal to display the Store Locator
// It is possible to launch the modal without parameter by passing NULL as parameter:
CRFeedbackDialog *feedbackDialog = [CRFeedbackDialog feedbackDialog];
[feedbackDialog presentFeedbackDialogFrom:self withParams:params];
// Launch a modal to send feedback to the "velo-brest" point of sale:
// It is possible to launch the modal without parameter by passing NULL as parameter:
[feedbackDialog presentFeedbackDialogFrom:self withStoreIdString:storeID withParams:params];
// Showcase part
// Launch a modal to display the Store Display to the "velo-brest" point of sale:
[feedbackDialog presentStoreDisplayDialogFrom:self withStoreIdString:storeID withParams:NULL];
//To retrieve the ratings related to the point of sale:
CRSdk *sdk = [CRSdk critizrSDKInstance:self];
[sdk fetchRatingForPlace:storeID withDelegate:self];
}
- (void)critizrPlaceRatingFetched:(double)customerRelationshipRating withSatisfaction:(double)satisfactionRating {
//The Customer Relationshio Score:
NSLog(@"%f", customerRelationshipRating);
//The Satisfaction Score:
NSLog(@"%f", satisfactionRating);
}
- (void)critizrPlaceRatingError:(NSError *)anError {
NSLog(@"Fail!");
}
@end
Updated about 2 months ago