In IOS, you can shake the screenshot to implement the problem feedback function)

Source: Internet
Author: User

. With the introduction of the following functions, you can easily shake the device when the tester encounters a BUG, and then automatically save it to the sandbox of the application. After saving it to the sandbox, you can customize a problem feedback page to describe the problem (you can use a third-party platform, such as xunfei voice, to achieve the effect of voice input, send the description information along with the page to the developer (it can be an email or directly sent to the background ).

ShakeAndCutter

#import <UIKit/UIKit.h>@interface UIViewController (ShakeAndCutter)@end

  

<QuartzCore/QuartzCore. h>-mark-shake action processing-() motionBegan :( UIEventSubtype) motion withEvent :( UIEvent *) NSLog (-() motionCancelled :( UIEventSubtype) motion withEvent :( ui* event *) NSLog (-() motionEnded :( UIEventSubtype) motion withEvent :( UIEvent *) NSLog (TestFeedbackViewController * testFeedbackViewController = [[TestFeedbackViewController alloc] initWithNibName: mark-screenShot processing-(UIWindow * screenWindow = UIImage * screenShot = NSData * screenShotPNG = NSError * error = [screenShotPNG writeToFile: [[NSHomeDirectory () stringByAppendingPathComponent:] response:] options: NSAtomicWrite error :&

  

  • For devices above IOS6.0, you only need to import the header file # import "UIViewController + ShakeAndCutter In the pch file of the project. h "(I have tested IOS6.0.1, IOS6.1.5, and IOS7.0.6). After the test is completed, you only need to comment out or delete this line of code;
  • For devices lower than IOS6.0, you may need to add the following code on the page that requires a shake effect (there are no devices lower than IOS6.0 at hand. If you have any, please verify it, thank you very much ):

Method, add two lines of code:

  [self becomeFirstResponder];

Method, add a line of code:

 [self becomeFirstResponder];

Method, add a line of code:

 [self resignFirstResponder];

MailViewController. h file source code:

  <UIKit/UIKit.h>  <MessageUI/MessageUI.h> <MessageUI/MFMailComposeViewController.h>   MailViewController : UIViewController< MFMessageComposeViewControllerDelegate>      UIButton                    *   

-() InitWithNibName :( NSString *) nibNameOrNil bundle :( NSBundle * self =-(self. title = shareToMailButton = [self buttonWithFrame: CGRectMake (,) action: @ selector (btnClicked :) withTag: [shareToMailButton setTitle:-(mark-custom method -() btnClicked :( UIButton * btnSender = (UIButton *:-(UIButton *) buttonWithFrame :( CGRect) frame action :( SEL) action withTag :( UIImage * buttonBackgroundImage = [UIImag E imageNamed:] stretchableImageWithLeftCapWidth: topCapHeight: UIImage * Height = [[UIImage imageNamed:] stretchableImageWithLeftCapWidth: topCapHeight: UIButton * button = button. frame = button. tag =-(Class mailClass = (NSClassFromString (mailClass! = UIAlertView * alert = [[UIAlertView alloc] initWithTitle: message: self cancelButtonTitle:-(MFMailComposeViewController * picker = picker. authorization = [picker setSubject: NSArray * toRecipients = [NSArray arrayWithObject: NSData * myData = [NSData metadata: [[NSHomeDirectory () Metadata:] metadata: [picker addAttachmentData: myData mimeType: fileName: NSString * emailBody = [NSString stringWithFormat:-() mailComposeController :( MFMailComposeViewController * didFinishWithResult :( partial) result error :( NSError * NSLog (); NSLog (); NSLog (-() messageComposeViewController :( MFMessageComposeViewController * NSLog (

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.