IOS integrated Ali user feedback function and app score

User feedback function is almost every app have a function, realize the connection and communication with users through feedback, collect user feedback whenever and wherever possible and Bug reports, communicate with users of instant, to a certain extent to enhance the competitiveness of the app. The app score is also a common feature. Next to share with you how to collect their own projects into the river Ali user feedback module, in addition to how to achieve the app scoring function.

A user feedback function
1 first need to apply for appkey. and Ali rivers need to generate their own SDK and download SDK into their own projects, in addition to all of the downloaded demo Ali, the inside of the TWMessageBarManager project in their import package.

2 add the following dependencies in the project:

UIKit.framework AddressBook.framework SystemConfiguration.framework CoreLocation.framework CoreTelephony.framework CoreData.framework libz.tbd libstdc++.6.0.9.tbd MobileCoreServices.framework ImageIO.framework AudioToolbox.framework AVFoundation.framework AssetsLibrary.framework CoreMotion.framework

3 import header file

#import < YWFeedbackFMWK/YWFeedbackKit.h> #import "TWMessageBarManager.h"

4 achieve feedback function

- (void) viewDidLoad {[super viewDidLoad]; self.title = @ "feedback and give app score; self.view.backgroundColor = [UIColor whiteColor]; / / appkey self.appKey application in Ali Wikipedia @ =" appkey "; self.environment = YWEnvironmentRelease; UIButton = *feedbackButton [UIButton buttonWithType:UIButtonTypeSystem]; feedbackButton.frame = CGRectMake (100, 150, 100, 50); [self.view addSubview:feedbackButton]; [feedbackButton setTitle:@" feedback "forState: UIControlStateNormal]; [feedbackButton addTarget:self action:@selector (actionOpenFeedback) forControlEvents:UIControlEventTouchUpInside]; UIButton *markButton = [UIButton buttonWithType:UIButtonTypeSystem]; markButton.Frame = CGRectMake (100, 200, 100, 50); [self.view addSubview:markButton]; [markButton setTitle:@ forState:UIControlStateNormal]; [markButton addTarget:self "score" action:@selector (markButtonAction) forControlEvents:UIControlEventTouchUpInside] any additional setup; / / Do after loading the view, typically from a nib. #pragma mark} - tone feedback - (void) actionOpenFeedback{self.tabBarController.tabBar.hidden = YES; self.appKey = @ "appkey"; self.feedbackKit [[YWFeedbackKit alloc] = initWithAppKey:self.appKey]; _feedbackKit.environment = self.environment; #warning App _feedbackKit.extInfo = @{@ custom extension feedback data "loginTime": [[NSDate date] description], "visitPath": @ @ "landing About -> -> feedback "@" using a custom extension information ": @" developers can set custom information according to the different needs, easy to view "} in feedback systems; #warning _feedbackKit.customUIPlist = [NSDictionary custom feedback page configuration dictionaryWithObjectsAndKeys:@" /te/'st//Value1/ "," testKey1 "," @ @ alert (test< script> / "error.yaochen/") < /alert> Value2 "," testKey2 ", @ nil]; [self _openFeedbackViewController];} #pragma mark pop-up feedback page - (void) _openFeedbackViewController __weak typeof (self) {weakSelf = self; [_feedbackKit makeFeedbackViewControllerWithCompletionBlock:^ (YWFeedbackViewController *viewController, NSError *error) {if (viewController! = Nil) {#warning Where you can set you need to display the title, NAV leftBarButtonItem, rightBarButtonItem viewController.title = @ "feedback"; / / UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewController]; viewController.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1] NSFontAttributeName: [UIFont fontWithName:@ "Helvetica" size:18]}; [self.navigationController pushViewController:viewController animated:YES]; viewController.navigationController.interactivePopGestureRecognizer.delegate = self; self.navigatio (ID) NController.interactivePopGestureRecognizer.delegate= (ID) self; viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@ style:UIBarButtonItemStylePlain target:weakSelf action:@selector "return" (cancelButtonAction); viewController.navigationItem.leftBarButtonItem.tintColor = [UIColor colorWithRed:0.59 green:0.59 blue:0.59 alpha:1]; viewController.tabBarController.tabBar.hidden = YES; __weak typeof (NAV) weakNav = NAV; setOpenURLBlock:^ [viewController (NSString *aURLString, UIViewController *aParentController) {UIViewController *webVC = [[UIViewController alloc] initWithNibName:nil bundle:nil]; UIWebView *webView = [[UIWebView alloc] initWithFrame:webVC.view.bounds]; webView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; [webVC.view addSubview:webView]; [weakNav pushViewController:webVC animated:YES]; [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:aURLString]]];}]; else} {NSString *title = [error.userInfo objectForKey:@ "MSG"]? ": @ interface failure, please keep the network unobstructed! "[[TWMessageBarManager sharedInstance] showMessageWithTitle:title description:nil; type:TWMessageBarMessageTypeError];}]};} - (void) cancelButtonAction{[self.navigationController popViewControllerAnimated:YES];}

Two, to the app score in two ways, one is to jump to the AppStore score, and the other is the use of StoreKit in the application to achieve the score, but the second method is a bit slow.

1 jump directly to AppStore

/ / jump to the AppStore score, XXXXXX app ID, can view the link to AppStore URL NSString for *baseUrl = @ " Mt=8"; [[UIApplication sharedApplication]openURL:[NSURL URLWithString:baseUrl]];

2 the use of StoreKit in the application of the achievement of the first
&lt #import; StoreKit/StoreKit.h>
proxy SKStoreProductViewControllerDelegate
implementation method

The application to the / / APP score, to return to the page before the SKStoreProductViewController *storeProductVC =[[SKStoreProductViewController alloc]init]; storeProductVC.delegate = self; / / the first parameter is application identifier consisting of ID dictionary. The second argument is a block callback. [storeProductVC @ loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier: "1053328148" completionBlock:^ (BOOL result NSError}, *error) {if (result) {[self presentViewController:storeProductVC animated:YES completion:^{}];}else{NSLog ("error:% @ @", error);}}];

Implement proxy method

//SKStoreProductViewController - (void) productViewControllerDidFinish: agent method (SKStoreProductViewController* viewController) {/ / return on a page [self dismissViewControllerAnimated:YES completion:nil];}

In this way, feedback and scoring functions on the realization of a very simple. Users to send feedback, we can directly to the background of the river to the user to reply.
feedback effect diagram is as follows:

IOS integrated Ali user feedback function and app score

Demo address