Summary of knowledge points frequently used or not commonly used in iOS development, several years of collection and accumulation (stepped on the pit).

A, the iPhone Size

Mobile phone models The screen size
iPhone 4 4s 320 * 480
iPhone 5 5s 320 * 568
iPhone 6 6s 375 * 667
iphone 6 plus 6s plus 414 * 736

2. Set the title color for the Navigation Bar

UIColor *whiteColor = [UIColor whiteColor];
NSDictionary *dic = [NSDictionary dictionaryWithObject:whiteColor forKey:NSForegroundColorAttributeName];
[self.navigationController.navigationBar setTitleTextAttributes:dic];Copy the code

How to store a CGPoint in an array

CGPoint itemSprite1position = CGPointMake(100, 200); NSMutableArray * array = [[NSMutableArray alloc] initWithObjects:NSStringFromCGPoint(itemSprite1position),nil]; CGPoint point = CGPointFromString([array objectAtIndex:0]); NSLog(@"point is %@.", NSStringFromCGPoint(point));Copy the code

Thank you @BigParis for your suggestion. You can use NSValue to save the basic data, which is more clear and definite.

CGPoint itemSprite1position = CGPointMake(100, 200); NSValue *originValue = [NSValue valueWithCGPoint:itemSprite1position]; NSMutableArray * array = [[NSMutableArray alloc] initWithObjects:originValue, nil]; NSValue *currentValue = [array objectAtIndex:0]; CGPoint point = [currentValue CGPointValue]; NSLog(@"point is %@.", NSStringFromCGPoint(point));Copy the code

Now Xcode7 OC supports generics, which can be saved using NSMutableArray *array.

4. UIColor gets RGB values

UIColor *color = [UIColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
const CGFloat *components = CGColorGetComponents(color.CGColor);
NSLog(@"Red: %f", components[0]);
NSLog(@"Green: %f", components[1]);
NSLog(@"Blue: %f", components[2]);
NSLog(@"Alpha: %f", components[3]);Copy the code

5. Modify textField placeholder font color and size

self.textField.placeholder = @"username is in here!" ; [self.textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"]; [self.textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];Copy the code

It is recommended to use attributedString (thanks to @honglinghe).

NSString *string = @" Brave New World "; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, [string length])]; [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(0, [string length])]; self.textField.attributedPlaceholder = attributedString;Copy the code

The distance between two points

static __inline__ CGFloat CGPointDistanceBetweenTwoPoints(CGPoint point1, CGPoint point2) { CGFloat dx = point2.x - point1.x; CGFloat dy = point2.y - point1.y; return sqrt(dx*dx + dy*dy); }Copy the code

7, IOS development – close/close keyboard method summary

1. Press the Return button to fold up the keyboard

- (BOOL)textFieldShouldReturn:(UITextField *)textField 
{
    return [textField resignFirstResponder]; 
}Copy the code

2. Click the background View to close the keyboard

[self.view endEditing:YES];Copy the code

3, You can add this sentence anywhere, can be used to unify the keyboard

[[[UIApplication sharedApplication] keyWindow] endEditing:YES];Copy the code

Note when using imagesqa. xcassets

When you drag an image directly into imagesqa.xcassets, the name of the image remains. If the name of the image is too long, the name will be stored in imagesqa.xcassets. If the name is too long, the SourceTree will fail.

UIPickerView judge from start to end of selection

To start with, you need to inherit UiPickerView, create a subclass, and override it in that subclass

- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent*)eventCopy the code

When [super hitTest:point withEvent:event] returns not nil, the UIPickerView is clicked. End the selected delegate method that implements UIPickerView

- (void)pickerView:(UIPickerView*)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)componentCopy the code

When this method is called, the selection is over.

IOS simulator keyboard events

When the iOS emulator selects Keybaord->Connect Hardware Keyboard, the keyboard does not pop up.


When added to the code

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillHide)
                                                 name:UIKeyboardWillHideNotification
                                               object:nil];Copy the code

Get keyboard events. – (void)keyboardWillHide. Will not be called in this case. Because there is no keyboard hide and show.

Using size classes on ios7, black on top and black on bottom

After using size classes, the top and bottom sections of the ios7 emulator appear black

This can be done by going to General->App Icons and Launch Images->Launch Images Source and setting images.xcassets.




11. The PNG

Set different sizes to size classes

Font sets different size classes.




12. The PNG

Update UILabel text in thread

[self.label1 performSelectorOnMainThread:@selector(setText:)                                      withObject:textDisplay
                                   waitUntilDone:YES];Copy the code

Label1 is UILabel, which can be used to update text when it is needed in child threads. All the other UIViews are the same.

14, use UIScrollViewKeyboardDismissMode implements the Message app

The ability to make the keyboard disappear while scrolling, like in the Messages app, is a great experience. However, integrating this behavior into your app can be difficult. Fortunately, Apple has added a nice property called keyboardDismissMode to UIScrollView to make it a lot easier.

Now just change a simple property in the Storyboard, or add a line of code, and your app can do the same thing as a Messages app.

This attribute is used a new UIScrollViewKeyboardDismissMode enum enumerated types. The possible values for this enum enum type are as follows:

typedef NS_ENUM(NSInteger, UIScrollViewKeyboardDismissMode) {
    UIScrollViewKeyboardDismissModeNone,
    UIScrollViewKeyboardDismissModeOnDrag,      // dismisses the keyboard when a drag begins
    UIScrollViewKeyboardDismissModeInteractive, // the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss
} NS_ENUM_AVAILABLE_IOS(7_0);Copy the code

Here are the properties you need to set to make the keyboard disappear when scrolling:




14. PNG

Referenced from: “_sqlite3_bind_blob”

Load sqlite3. Dylib into the framework

Ios7 Statusbar text color

IOS7, on the status bar by default font color is black, to change for the need of the white in the infoPlist UIViewControllerBasedStatusBarAppearance to NO, then add in the code: [application setStatusBarStyle:UIStatusBarStyleLightContent];

Get the current hard drive space

NSFileManager *fm = [NSFileManager defaultManager]; NSDictionary *fattributes = [fm attributesOfFileSystemForPath:NSHomeDirectory() error:nil]; NSLog (@ % lldG "capacity", [[fattributes objectForKey: NSFileSystemSize] longLongValue] / 1000000000); NSLog (@ "available" % lldG, [[fattributes objectForKey: NSFileSystemFreeSize] longLongValue] / 1000000000);Copy the code

18. Set the transparency of UIView without affecting other sub views

UIView sets the alpha value, but the content becomes transparent as well. Is there a solution?

Set the opacity of the background color color

Such as:

[self.testView setBackgroundColor:[UIColor colorWithRed:0.0 green:1.0 blue:1.0 alpha:0.5]];Copy the code

If you set the alpha of color, you can achieve transparency of background color. When other sub views are not affected, add alpha to color, or change the alpha value.

// Returns a color in the same color space as the receiver with the specified alpha component. - (UIColor *)colorWithAlphaComponent:(CGFloat)alpha; / / eg. [the backgroundColor colorWithAlphaComponent: 0.5];Copy the code

19. Convert color to UIImage

UIImage - (UIImage *)createImageWithColor:(UIColor *)color {CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);  UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return theImage; }Copy the code

NSTimer

NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:.02 target:self selector:@selector(tick:) userInfo:nil repeats:YES];

    [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];Copy the code

Add a timer to NSRunLoop.

21, Bundle Identifier application identifier

Bundle Identifier is an application identifier that distinguishes an application from other apps.

NSDate retrieves the time several years ago

Eg. Get the date 40 years ago

NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setYear:-40];
self.birthDate = [gregorian dateByAddingComponents:dateComponents toDate:[NSDate date] options:0];Copy the code

Hide the StatusBar when loading the iOS startup image

Simply add Status bar is INITIALLY Hidden to info.plist and set it to YES




23. JPG

24. IOS development, mixed use of ARC and non-ARC in projects

In Xcode projects we can use a mixture of ARC and non-ARC modes.

If your project uses non-ARC mode, add the -fobjc-arc tag to the ARC mode code files.

If your project uses ARC mode, add the -fno-objc-arc tag to non-ARC code files.

Methods for adding labels:

  • Open: your target -> Build Phases -> Compile Sources.
  • Double-click the corresponding *.m file
  • In the pop-up window, enter the aforementioned tabs -fobjc-arc / -fno-objC-Arc
  • Click Done to save

Twenty-five, iOS7 boundingRectWithSize: options: attributes: context: the use of computed text size

Before using the nsstrings class sizeWithFont: constrainedToSize: lineBreakMode: method, but this method has been iOS7 Deprecated. And new out an boudingRectWithSize iOS7: options: attributes: the context method instead. How do you use it, especially that attribute

NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:13]}; CGSize size = [@ "related nsstrings" boundingRectWithSize: CGSizeMake (100, 0) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute context:nil].size;Copy the code

Note the use of NSDate

NSDate The best time to save and transfer data is UTC.

Change the time to the local time when it is displayed to the user.

Present problem of a UIViewController property in UIViewController

If there is A property property UIViewController B in UIViewController A, after instantiation, add vbC. view to the main UIViewController A.view, If done on viewB – (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_AVAILABLE_IOS(5_0); The operation will appear, “Presenting view controllers on detached view controllers is discouraged” problem.

BVC has been present in AVC, so it will be wrong to try again.

You can use

[self.view.window.rootViewController presentViewController:imagePicker
                                                      animated:YES
                                                    completion:^{
                                                        NSLog(@"Finished");
                                                    }];Copy the code

To solve it.

UITableViewCell indentationLevel

The UITableViewCell attribute NSInteger indentationLevel is used to set the indentationLevel value for the cell.

There are CGFloat indentationWidth; Property to set the width of the indentation.

Total indentationWidth: indentationLevel * indentationWidth

ActivityViewController shares using AirDrop

Share using AirDrop:

NSArray *array = @[@"test1", @"test2"];

UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:array applicationActivities:nil];

[self presentViewController:activityVC animated:YES
                 completion:^{
                     NSLog(@"Air");
                 }];Copy the code

You can pop up the interface:




29. The PNG

Get height of CGRect

CGRect height, in addition to the self. CreateNewMessageTableView. Frame. The size, height, do some grammar acquisition.

You can also use CGRectGetHeight (self) createNewMessageTableView) frame) for direct access.

In addition to this method there is func CGRectGetWidth(rect: CGRect) -> CGFloat

And so on

func CGRectGetMinX(rect: CGRect) -> CGFloat
func CGRectGetMidX(rect: CGRect) -> CGFloat
func CGRectGetMaxX(rect: CGRect) -> CGFloat
func CGRectGetMinY(rect: CGRect) -> CGFloatCopy the code

31. Print %

NSString *printPercentStr = [NSString stringWithFormat:@"%%"];Copy the code

32. Check whether IDFA is used in the project

allentekiMac-mini:JiKaTongGit lihuaxie$ grep -r advertisingIdentifier . grep: ./ios/Framework/AMapSearchKit.framework/Resources: No such file or directory Binary file ./ios/Framework/MAMapKit.framework/MAMapKit matches Binary file . / ios/Framework/MAMapKit. Framework/Versions/against 2.4.1 e00ba6a/MAMapKit matches Binary file ./ios/Framework/MAMapKit.framework/Versions/Current/MAMapKit matches Binary file ./ios/JiKaTong.xcodeproj/project.xcworkspace/xcuserdata/lihuaxie.xcuserdatad/UserInterfaceState.xcuserstate matches allentekiMac-mini:JiKaTongGit lihuaxie$

Open the terminal, go to the project directory, and enter: grep -r advertisingIdentifier.

You can see that IDFA is used in those files and if it is used it will be displayed.

33. APP blocks trigger events

// Disable user interaction when download finishes
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];Copy the code

34. Set the Status bar color

Status bar color Settings:

  1. If there is no Navigation bar, set it directly

    // make status bar background color
    self.view.backgroundColor = COLOR_APP_MAIN;Copy the code
  2. If there is a Navigation bar, add a view to the navigation bar to set the color.

    // status bar color
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, -20, ScreenWidth, 20)];
    [view setBackgroundColor:COLOR_APP_MAIN];
    
    [viewController.navigationController.navigationBar addSubview:view];Copy the code

NSDictionary to NSString

// Start
NSDictionary *parametersDic = [NSDictionary dictionaryWithObjectsAndKeys:
                               self.providerStr, KEY_LOGIN_PROVIDER,
                               token, KEY_TOKEN,
                               response, KEY_RESPONSE,
                               nil];

NSData *jsonData = parametersDic == nil ? nil : [NSJSONSerialization dataWithJSONObject:parametersDic options:0 error:nil];
NSString *requestBody = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];Copy the code

Convert dictionary to NSData and data to string.

In iOS7 UIButton setImage does not work

If you set image in iOS7, it doesn’t take effect.

The enable property of UIButton is NO. Set enable to YES.

37. User-agent Determines the device

UIWebView determines which interface to display based on the user-Agent value. If you want to set it to global, load it directly when the application starts.

- (void)appendUserAgent
{
    NSString *oldAgent = [self.WebView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
    NSString *newAgent = [oldAgent stringByAppendingString:@"iOS"];

    NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:
                         newAgent, @"UserAgent", nil];

    [[NSUserDefaults standardUserDefaults] registerDefaults:dic];
}Copy the code

@ “iOS” is the added custom.

UIPasteboard mask paste option

When UIpasteboard string is set to @ “”, then string becomes nil. The paste option will not appear.

Use class_addMethod

When ARC environment

class_addMethod([self class], @selector(resolveThisMethodDynamically), (IMP) myMethodIMP, “v@:”);

If you want to use @selector, you need to use a super class, otherwise you’ll get an error. When MRC environment

class_addMethod([EmptyClass class], @selector(sayHello2), (IMP)sayHello, “v@:”);

I can define it any way I want. However, the system will display a warning, you can ignore the warning.

AFNetworking sends form-data

Convert JSON data to NSData and put it in the body of the Request. Sending it to the server is in form-data format.

41. Attention to non-empty judgment

BOOL hasBccCode = YES;
if ( nil == bccCodeStr
    || [bccCodeStr isKindOfClass:[NSNull class]]
    || [bccCodeStr isEqualToString:@""])
{
    hasBccCode = NO;
}Copy the code

If non-null judgment and type judgment are performed, a new type judgment is required and then a non-null judgment is performed; otherwise, the crash will occur.

IOS 8.4 UIAlertView keyboard display problem

You can check whether the keyboard is hidden before you call UIAlertView.

@property (nonatomic, assign) BOOL hasShowdKeyboard; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showKeyboard) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dismissKeyboard) name:UIKeyboardDidHideNotification object:nil]; - (void)showKeyboard { self.hasShowdKeyboard = YES; } - (void)dismissKeyboard { self.hasShowdKeyboard = NO; } while ( self.hasShowdKeyboard ) { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; } UIAlertView* alerView = [[UIAlertView alloc] initWithTitle:@"" message:@" cancelButtonTitle:@" OtherButtonTitles: @" confirm ", nil]; [alerview show];Copy the code

43. Setup of Chinese input method for simulator

The default configuration of the simulator does not have “small Earth” and can only be entered in English. The method of adding Chinese is as follows:

Select Settings– >General–>Keyboard–>International KeyBoards–>Add New Keyboard–>Chinese Simplified(PinYin) That is, we generally use the simplified Chinese pinyin input method, after good configuration, and then input text, click the pop-up keyboard “small earth” can be input Chinese. If not, long press “Small Earth” to select Chinese.

44, iPhone number pad

Phone keyboard type:

  1. The number pad can only enter numbers and cannot switch to other inputs




    number_pad.png

  2. Phone Pad type: Used for making calls. You can enter numbers and + * #




    phone_pad.png

45. UIView comes with animation flip interface

- (IBAction)changeImages:(id)sender { CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration: 1.0]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:_parentView cache:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_parentView cache:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:_parentView cache:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:_parentView cache:YES]; NSInteger purple = [[_parentView subviews] indexOfObject:self.image1]; NSInteger maroon = [[_parentView subviews] indexOfObject:self.image2]; [_parentView exchangeSubviewAtIndex:purple withSubviewAtIndex:maroon]; [UIView setAnimationDelegate:self]; [UIView commitAnimations]; }Copy the code

46. KVO listens for other class variables

[[HXSLocationManager sharedManager] addObserver:self
                                         forKeyPath:@"currentBoxEntry.boxCodeStr"
                                            options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionOld context:nil];Copy the code

In the self implementation classes for [HXSLocationManager sharedManager] class variables in @ “currentBoxEntry. BoxCodeStr” listening.

Ios9 Crash animateWithDuration

In iOS9, if you’re doing animateWithDuration, the view is released, you’re going to crash.

[UIView animateWithDuration: 0.25 f animations: ^ {self. Frame = selfFrame;  } completion:^(BOOL finished) { if (finished) { [super removeFromSuperview]; } }];Copy the code

Will crash.

[UIView animateWithDuration: 0.25 f delay: 0 usingSpringWithDamping: initialSpringVelocity 1.0:1.0 options:UIViewAnimationOptionCurveLinear animations:^{ self.frame = selfFrame;  } completion:^(BOOL finished) { [super removeFromSuperview]; }];Copy the code

Won’t Crash.

Translate URL encoding to NSString

When deleting movies in iPTV project, two parameters, user name and movie ID, need to be transmitted in URL. If the user name contains Chinese characters, the user name cannot be deleted.

In previous tests, the user name bound to the mobile phone number was English or numeric. The problem was discovered when the phone number was tested.

If the URL contains Chinese characters, you need to translate the URL encoding.

urlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];Copy the code

Xcode iOS loading images can only be PNG

JPG images can be seen in Xcode, but will fail when loading. Could not load the “ReversalImage1” image referenced from a nib in the bun

PNG images must be used.


Add the suffix if you want to use JPG

[UIImage imageNamed:@"myImage.jpg"];Copy the code

50. Save the full screen as image

CGSize imageSize = [[UIScreen mainScreen] bounds].size; UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0); CGContextRef context = UIGraphicsGetCurrentContext(); for (UIWindow * window in [[UIApplication sharedApplication] windows]) { if (! [window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) { CGContextSaveGState(context); CGContextTranslateCTM(context, [window center].x, [window center].y); CGContextConcatCTM(context, [window transform]); CGContextTranslateCTM(context, -[window bounds].size.width*[[window layer] anchorPoint].x, -[window bounds].size.height*[[window layer] anchorPoint].y); [[window layer] renderInContext:context]; CGContextRestoreGState(context); } } UIImage *image = UIGraphicsGetImageFromCurrentImageContext();Copy the code

51. Determine the location status locationServicesEnabled

[CLLocationManager locationServicesEnabled] checks the location service switch of the entire iOS system and does not check whether the current app is disabled. through

CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
    if (kCLAuthorizationStatusDenied == status || kCLAuthorizationStatusRestricted == status) {
        [self locationManager:self.locationManager didUpdateLocations:nil];
    } else { // the user has closed this function
        [self.locationManager startUpdatingLocation];
    }Copy the code

CLAuthorizationStatus to determine whether GPS can be accessed

52. Pay attention to the size of wechat sharing

The size of text must be greater than 0 and less than 10K

Image must be less than 64K

The URL must be greater than 0K

53. Clearing the image cache

SDWebImage is generally used to display and cache images. Generally, if the content of the cache is too much, the cache needs to be cleared

When clearing SDWebImage’s memory and hard disk, you can clear session and cookie caches at the same time.

// clearMemory [[SDImageCache sharedImageCache] clearMemory]; NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; for (NSHTTPCookie *cookie in [storage cookies]) { [storage deleteCookie:cookie]; } NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration]; [config.URLCache removeAllCachedResponses]; [[NSURLCache sharedURLCache] removeAllCachedResponses]; / / clean up hard drive [[SDImageCache sharedImageCache] clearDiskOnCompletion: ^ {[MBProgressHUD hideAllHUDsForView: self. The view animated:YES]; [self.tableView reloadData]; }];Copy the code

TableView Header View scroll with TableView

When the TableView type is plain, the header View will stay at the top.

When it’s group, the header view will scroll along with the TableView.

55. TabBar title setting

Tabbars can be set in xiB or storyboard




55. The PNG

One badge is a badge on the icon to add a corner.

1. Self. NavigationItem. Title set navigation title need to use the set.

2. Self. title in TAB bar main VC setting self.title causes navigation title to be changed along with TAB bar title.

UITabBar, remove the shadow at the top

Add these two lines of code:

[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
[[UITabBar appearance] setBackgroundImage:[[UIImage alloc] init]];Copy the code

The top shadow is on UIWindow, so it can’t be easily set to go away.

57. When in a row, multiple UIKits are dynamic width Settings




57. The PNG

Set horizontal to compress the UIKit in preference to long content.

58. JSON ‘ ‘converts to nil

When using AFNetworking, use

AFJSONResponseSerializer *response = [[AFJSONResponseSerializer alloc] init];
response.removesKeysWithNullValues = YES;

_sharedClient.responseSerializer = response;Copy the code

This parameter removesKeysWithNullValues null values can be deleted, then the Value is nil

// END

Write spit, so long should be no one will read, read the end of calculate you malicious.