IOS development experience summary

In the development of iOS often need to use or not commonly used knowledge points summary, a few years of collection and accumulation (stepped pit).

A, iPhone Size

Phone model Screen size
IPhone 4 4S 320 * 480
IPhone 5 5S 320 * 568
IPhone 6 6S 375 * 667
IPhone 6 plus 6S plus 414 * 736

Two, to navigation Bar set title color

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

Three, how to put a CGPoint into the array

CGPoint itemSprite1position = CGPointMake (100, 200); NSMutableArray * array = [[NSMutableArray alloc] initWithObjects:NSStringFromCGPoint (itemSprite1position, nil]); / / this is a process of value from the array of CGPoint: point = CGPointFromString ([array objectAtIndex:0]); NSLog (@ point is%@. ", NSStringFromCGPoint (point));

Thanks to @bigParis’s proposal, you can use NSValue for the preservation of basic data, using this method is more clear.

CGPoint itemSprite1position = CGPointMake (100, 200); NSValue *originValue = [NSValue valueWithCGPoint:itemSprite1position]; NSMutableArray * array = [[NSMutableArray alloc] initWithObjects:originValue nil]; / / this is a process of value from the array of NSValue: *currentValue = [array objectAtIndex:0]; CGPoint point = [currentValue CGPointValue]; NSLog (@ point is%@. ", NSStringFromCGPoint (point));

Xcode7 now supports generics after OC, you can use NSMutableArray< NSString *> *array to save.

Four, UIColor get RGB value

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]);

Five, modify the font color, size of placeholder textField

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

Recommend the use of attributedString
settings (thanks to the recommendation of @HonglingHe)

NSString *string = @ "beautiful 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;

Six, the distance between two points

Static __inline__ CGFloat CGPointDistanceBetweenTwoPoints (CGPoint point1, CGPoint point2) {DX = point2.x - point1.x; CGFloat dy = point2.y; point1.y; return sqrt (dx*dx + dy*dy);}

Seven, IOS development – off / take off keyboard method summary

1, click the Return button when folded keyboard

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

2, click on the background View keyboard

[self.view endEditing:YES];

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

[[[UIApplication sharedApplication] keyWindow] endEditing:YES];

Eight, the need to pay attention to the use of ImagesQA.xcassets

The picture directly into the image to ImagesQA.xcassets, the name of the picture will remain.
this time if the picture name is too long, then the name will be stored in the ImagesQA.xcassets, the name is too long will cause SourceTree to determine the anomaly.

Nine, UIPickerView judgment to start to choose to end

To begin with, you need to inherit UiPickerView, create a subclass, and load it in a subclass

(UIView*) hitTest: (CGPoint) point withEvent: (UIEvent*) event

When [super hitTest:point withEvent:event] is not nil, it is in the middle of UIPickerView.
end of the selection, the realization of the UIPickerView delegate method

- (void) pickerView: (UIPickerView*) pickerView didSelectRow: (NSInteger) row inComponent: (NSInteger) component

When this method is called, the selection is over.

Ten, iOS emulator keyboard events

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


When the code is added

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

Get keyboard events. So in this scenario will not be called – (void) keyboardWillHide.
because there is no hidden keyboard and display.

Eleven, on the ios7 using size classes above the black

After using the size classes, the upper and lower parts of the black on the ios7 emulator

Can be in General-> App and Launch Images-> Launch Images Source set up to solve Images.xcassets Icons.

IOS development experience summary
eleven.Png

Twelve, set different size in size classes

Classes set different size Font.

IOS development experience summary
twelve.Png

Thirteen, update the UILabel thread text

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

Label1 is UILabel, you can use this method to update the text in a child thread.
other UIView are the same.

Fourteen, the use of UIScrollViewKeyboardDismissMode to achieve the behavior of Message app

It can be a great experience to roll the keyboard away like a Messages app. However, it is difficult to integrate this behavior into your app. Fortunately, apple added to the UIScrollView a very useful property keyboardDismissMode, which can be a lot easier.

Now only need to change a simple attribute in Storyboard, or add a line of code, your app can do the same thing as Messages app.

This property uses the new UIScrollViewKeyboardDismissMode enum enumeration type. The possible values of the enum enumeration type are as follows:

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

The following is a property that allows the keyboard to disappear when scrolling:

IOS development experience summary
fourteen.Png

Fifteen, the wrong _sqlite3_bind_blob, referenced from:

Load sqlite3.dylib to framework

Sixteen, ios7 statusbar text color

IOS7 status bar, the default font color is black and white in need to modify the infoPlist UIViewControllerBasedStatusBarAppearance set to NO, then add in the code:
[application setStatusBarStyle:UIStatusBarStyleLightContent];

Seventeen, access to the current hard disk space

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

Eighteen, to set the transparency of UIView, does not affect other sub views

UIView set the alpha value, but the content is also changed to become transparent. Is there a solution?

Set the transparency in the color of background color

For example:

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

Set up the color alpha, you can achieve the background color is transparent, when other sub views is not affected to add alpha to color, or modify the value of alpha.

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

Nineteen, the color will be converted to UIImage

Color to 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 = UIGraphicsGetImageFromCurrentImageContext (*theImage) (UIGraphicsEndImageContext); return theImage;});

Twenty, NSTimer usage

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

Add timer in NSRunLoop

Twenty-one, Bundle identifier application identifier

Bundle identifier is the application identifier, indicating the difference between the application and other APP.

Twenty-two, NSDate get a few years ago

Eg. date to 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];

Twenty-three, iOS load start map hidden statusbar

Just need to add Status bar is initially hidden set to YES as good as
in info.plist

IOS development experience summary
twenty-three.Jpg

Twenty-four, iOS development, engineering mixed use of ARC and non ARC

Xcode project we can use ARC and non ARC mixed mode.

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

If your project is in ARC mode, add a -fno-objc-arc tag to the non ARC code file.

Method for adding labels:

  • Open: your target -> Build Phases -> Compile Sources.
  • Double click the corresponding *.m file
  • Enter the above mentioned label -fobjc-arc / -fno-objc-arc in the pop-up window
  • Click Done to save

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

Before using the sizeWithFont:constrainedToSize:lineBreakMode: method of the NSString class, but the method has already been iOS7 Deprecated, and iOS7 boudingRectWithSize:options:attributes:context out of a new method to replace.
and how to use it, especially the attribute

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

Twenty-six, NSDate use attention

NSDate in the preservation of data, data transmission, the best time to use UTC.

In the display to the interface to the user, the need to convert to local time.

Twenty-seven, in the UIViewController property a UIViewController Present problem

If a UIViewController A has a property attribute for UIViewController B is instantiated, add BVC.view to the main UIViewController A.view, if carried out in viewB – (void) presentViewController: (UIViewController *) viewControllerToPresent animated: (BOOL) flag (completion: (void ^) (void)) completion NS_AVAILABLE_IOS (5_0); the operation will occur, “Presenting view controllers on detached view controllers is discouraged” problem.

Think BVC has present to AVC, so once again will be wrong.

have access to

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

To solve.

Twenty-eight, the use of UITableViewCell indentationLevel

UITableViewCell property NSInteger indentationLevel use, set the value of the indentationLevel cell, you can divide the level of cell.

There are CGFloat indentationWidth; properties, set the width of the indentation.

Width of indent: indentationLevel * indentationWidth

Twenty-nine, ActivityViewController use AirDrop share

Use AirDrop to share:

NSArray *array = "test1" @[@, @ "test2"]; UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:array applicationActivities:nil] [self animated:YES completion:^{NSLog; presentViewController:activityVC (@ Air);}];

You can pop up interface:

IOS development experience summary
twenty-nine.Png

Thirty, get CGRect height

Get CGRect height, in addition to self.createNewMessageTableView.frame.size.height to do some grammar acquisition.

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

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

And so on simple method

Func CGRectGetMinX (rect: CGRect) -> CGFloat func (rect: CGRect) -> CGFloat func CGRectGetMaxX (rect: CGRect) -> CGFloat func CGRectGetMinY (rect: CGRect) -> CGFloat

Thirty-one, print%

NSString *printPercentStr = [NSString stringWithFormat:@%];

Thirty-two, in the project to see whether the use of IDFA

AllentekiMac-mini:JiKaTongGit lihuaxie$grep -r advertisingIdentifier
./ios/Framework/AMapSearchKit.framework/Resources: No such. Grep: file or directory
Binary file./ios/Framework/MAMapKit.framework/MAMapKit matches
Binary file./ios/Framework/MAMapKit.framework/Versions/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 to the project directory, enter:
grep -r advertisingIdentifier

You can see those files used in the IDFA, if used will be displayed.

Thirty-three, APP shield trigger event

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

Thirty-four, set the Status bar color

Status bar color settings:

  1. If there is no navigation bar, make status bar background color / / set self.view.backgroundColor = COLOR_APP_MAIN;
  2. If there is a navigation bar, add a view to the navigation bar to set the color. Bar color UIView / / status *view = [[UIView alloc] initWithFrame:CGRectMake (0, -20, ScreenWidth, 20)]; [view setBackgroundColor:COLOR_APP_MAIN]; [viewController.navigationController.navigationBar addSubview:view];

Thirty-five, NSDictionary to NSString

NSDictionary *parametersDic / / Start = [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];

Dictionary into NSData, data into string

Thirty-six, iOS7 UIButton setImage did not play a role

If image is not set in iOS7.

So that the UIButton property of enable is not valid is NO. Need to set enable to YES.

Thirty-seven, User-Agent judgment equipment

UIWebView will be based on the value of User-Agent to determine which interface to display.
if you need to set the global, then directly when the application starts loading.

- (void) appendUserAgent NSString [self.WebView stringByEvaluatingJavaScriptFromString:@ {*oldAgent = "navigator.userAgent"]; NSString *newAgent = [oldAgent stringByAppendingString:@ "iOS"]; NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys: @ newAgent, "UserAgent", nil] [[NSUserDefaults; standardUserDefaults] registerDefaults:dic];}

@ iOS @ for added custom.

Thirty-eight, UIPasteboard shield paste options

When UIpasteboard’s string is set to @ @, then string will become nil. There will be no paste option.

Thirty-nine, class_addMethod use

When the ARC environment

Class_addMethod ([self class], @selector (resolveThisMethodDynamically), (IMP) myMethodIMP, “[email protected]:”);

When using @selector need to use super class, otherwise it will be wrong.
when MRC environment

Class_addMethod ([EmptyClass class], @selector (sayHello2), (IMP) sayHello, “[email protected]:”);

Can be arbitrarily defined. However, the system will be warned, ignoring the warning can be.

Forty, AFNetworking transfer form-data

JSON data will be converted to NSData, into the Request body. Send to server is form-data format.

Forty-one, non empty judgment attention

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

If you do not empty judgments and type judgments, the need for a new type of judgment, and then non empty judgment, otherwise it will be crash.

Forty-two, iOS 8.4 UIAlertView keyboard display problem

You can call UIAlertView before the keyboard has been hidden judgment.

@property (nonatomic, assign) BOOL hasShowdKeyboard; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (showKeyboard) name:UIKeyboardWillShowNotification object:nil] [[NSNotificationCenter defaultCenter] addObserver: self; name:UIKeyboardDidHideNotification object:nil]; selector:@selector (dismissKeyboard) - showKeyboard (void) {self.hasShowdKeyboard = YES;} - (void dismissKeyboard) {self.hasShowdKeyboard = NO;} {[while (self.hasShowdKeyboard) [NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]] UIAlertView* alerview [[UIAlertView alloc];} = "initWithTitle:@" message:@ delegate:self cancelButtonTitle:@ "cancel changes?" "Cancel" @ otherButtonTitles: "OK", nil]; [alerview show];

Forty-three, simulator Chinese input method settings

The default configuration of the emulator is not “small earth” and can only be entered in english. The Chinese method is as follows:

Settings—> General–> Keyboard–> International KeyBoards–> Add New Keyboard–> Chinese Simplified (PinYin) Chinese simplified Pinyin input method we use, configured, and then enter the text, click the pop-up keyboard on the “small earth” can enter Chinese.
if not, you can press the “small earth” to choose chinese.

Forty-four, iPhone number pad

Phone keyboard type:

  1. Number pad can only enter numbers and cannot switch to other inputs
    IOS development experience summary
    number_pad.png
  2. Phone pad type: use when dialing a phone, you can enter the number and the
    IOS development experience summary
    phone_pad.png * #

Forty-five, UIView own animation flip interface

- (IBAction) changeImages: (ID) sender (context) {CGContextRef = UIGraphicsGetCurrentContext; [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0]; setAnimationTransition:UIViewAnimationTransitionCurlDown forView:_parentView cache:YES] [UIView [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];}

Forty-six, KVO listen to other variables

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

In the realization of the class self, [HXSLocationManager class sharedManager] in the variable @ @ currentBoxEntry.boxCodeStr monitor.

Forty-seven, ios9 crash animateWithDuration

In iOS9, if animateWithDuration, view is release will cause crash.

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

Would crash.

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

Not Crash.

Forty-eight, the NSString URL coding conversion

IPTV project in the deletion of the film, URL need to send the user name and the film ID two parameters. When the user name with the Chinese characters, delete failed.

Before the test, the phone number is bound to the user name is English or digital. Found the problem when the phone number test.

For URL in the case of Chinese characters, the need for URL encoding conversion.

UrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

Forty-nine, Xcode iOS loading pictures can only use PNG

Although the JPG can be seen in the picture of Xcode, but will fail when loading.
error Could not the load image referenced a nib in the from bun (ReversalImage1)

Must use PNG pictures.


If you need to use JPG need to add suffix

[UIImage imageNamed:@ "myImage.jpg"];

Fifty, save the full screen for image

CGSize imageSize = [[UIScreen mainScreen] bounds].size; UIGraphicsBeginImageContextWithOptions (imageSize, NO, 0); CGContextRef (context = UIGraphicsGetCurrentContext); for (UIWindow * window in [[UIApplication sharedApplication] windows] ([window) {if! 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]; CGContextRes ToreGState (context);} UIImage *image = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext ();

Fifty-one, determine the position of locationServicesEnabled

The [CLLocationManager locationServicesEnabled] detects the location switch of the entire iOS system and cannot detect whether the current application is turned off. adopt

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

CLAuthorizationStatus to determine whether you can access GPS

Fifty-two, WeChat share attention when the size

The size of the text must be greater than 0 less than 10k

Image must be less than 64K

URL must be greater than 0k

Fifty-three, the picture cache empty

The general use of SDWebImage for image display and cache, the general cache content is more than the need to clear the cache

Clear SDWebImage memory and hard disk, you can also clear the cache of session and cookie.

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

Fifty-four, TableView Header View follow Tableview scroll

When tableview is plain, header View will stay on top.

When the type is group, the header view will roll with tableview.

Fifty-five, TabBar Title settings

In Xib or storyboard can be set in tabBar

IOS development experience summary
fifty-five.Png

badge is the built-in add a corner on the icon.

1 self.navigationItem.title set navigation Title need to use this to set.

2 self.title tab bar in the main VC, to set up the self.title will lead to the navigation and tab bar title are modified together with the title.

Fifty-six, UITabBar, remove the top of the shadow

Add these two lines of code:

[[UITabBar appearance] alloc] init]]; [[UITabBar appearance] setBackgroundImage:[[UIImage alloc] init]] (setShadowImage:[[UIImage);

The top shadow is on the UIWindow, so you can’t simply set it off.

Fifty-seven, when a line, a number of UIKit are dynamic width settings

IOS development experience summary
fifty-seven.Png

set the value of horizontal, indicating that there is a very long time, the first compression of the UIKit.

Fifty-eight, JSON “< null>” converted to nil

When using AFNetworking, use

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

This parameter removesKeysWithNullValues can delete the value of null, then Value is nil

/ / END

Write spit, so long should be no one will read, after reading your ruthless.