As a result of oneself likelihood recently memory began to drop, want pertinence to take a bit of measure so! I hope I won’t commit any more of the problems I committed before. If they still occur, I hope I can quickly find and solve the problems!

1. Problems related to iOS 10 2. Problems related to APP launch failure 3. When a page has multiple partition requests, different models will crash. 4.UI does not refresh data in time 5. 1> Text input box on the tableViewCell 2> Text input box on the navigation bar 3> text input box and check item on the same page on the TableView layout 7. 9.[__NSCFNumber length]: Linker command failed with exit code 1 (USe-V to see Invocation) Xcode 8 emulator could not debug 13. TableHeaderView refresh (remove subview and recreate assignment) 14. 15. During the loading process of UIWebView, a blank page will be displayed before the page is fully loaded. 16. Null is displayed in amount loading, and display is changed to loading — correct amount is displayed after loading. IOS11 /iPhoneX related adaptation problem 18. Navigation bar when switching avatar, cancel render (default after selected render blue) 19. In the case of multiple partitions, use Cell ids of different partitions to prevent data loss in sliding parts

Nonsense not to say, began to list, in order to continue to add later update convenient, here in reverse order!

## 19. In the case of multiple partitions, different partition Cell ids are used to prevent sliding part of data loss

The custom line is missing in the sliding cell

Solution: Use Cell ids of different partitions

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString  *cellId = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (indexPath.section == 0) {
        static NSString *vipCellId = @"vip_cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:vipCellId];
        if(! cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:vipCellId]; cell.selectionStyle = UITableViewCellSelectionStyleNone; UIView *line = [[UIView alloc] init]; line.backgroundColor = YYPLineColor; line.frame = CGRectMake(0, 43, UI_View_Width, 1); [cell.contentView addSubview:line]; }if (indexPath.row == 0) {
            cell.textLabel.text = @1 "test";
        } else if (indexPath.row == 1) {
            cell.textLabel.text = @"The test 2";

        return cell;
    } else if (indexPath.section == 1) { 
        YYPPetCell *cell = [YYPPetCell cellWithTableView:tableView];
        if (self.petList.count) {
            YYPPetModel *model = self.petList[indexPath.row];
            cell.model = model;
        return cell;
    return cell;
Copy the code

When switching avatars in navigation bar, cancel render (default render blue)

Declaration: The selected image is displayed as original, unrender (default render blue)

Using imageWithRenderingMode

[[UIImage imageNamed:@"day"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
Copy the code

IOS11 /iPhoneX related adaptation problems please go to :iOS11/iPhoneX related adaptation problems

Update adaptation version of iPhone X startup image adaptation added, do not forget to upload Icon. Otherwise, there will be a warning drop when uploading the version

## 16: display null in amount loading, display changed to loading as — display correct amount after loading.

When concatenating strings, null will be displayed during the amount loading process. Solution: To prevent null from being displayed during the amount loading process, change the loading process to –, and display the correct amount after loading.

valueLabel.text = self.allSale ? self.allSale : @"--";
Copy the code

Format the amount, please move: three places one comma ¥94,862.57

During UIWebView loading, a blank page is displayed before the page is fully loaded.

** Solution :** Make UIWebView background transparent.

web.backgroundColor = [UIColor clearColor];
web.opaque = NO;
[web setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"webbg.png"]]];
Copy the code

The startup page displays OK on the emulator, but not on the real machine

The image is JPG image, not PNG image. When you want PNG image again, the artist may directly change the JPG file suffix to PNG for you, but in essence, it is still a JPG image. The real machine cannot parse according to the PNG information you give.

The solution: Ask the artist for a new real PNG image, or do it yourself: open the JPG image in a drawing app and save it as a PNG image. Delete the APP and run it again.

Problems with tableHeaderView refresh (removing subviews and re-creating assignments) like some looping controls are particularly error-prone! Here’s an example:

Solution: Remove all data from the current child control before re-creating it and then assign it to prevent the control from creating data overlap. No loop, one line of code to remove all child views

  [self.tagsView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
Copy the code

The Xcode 8 simulator cannot debug The request was denied by service delegate (SBMainWorkspace) for reason: Unspecified. It’s been less than a week since I upgraded Xcode8.3. One minute I was happily writing code and debugging, and the next minute I couldn’t debug the simulator. God knows what I went through!


  1. Click on the project in front of the emulator -> New Scheme ->Target select the first Name and click OK by default to add a New project to the emulator.
  2. Go to projects at the front of the simulator ->Manage Schemes (if you complete the first step there will be two projects, remove them from the list) to remove the ones you don’t want and click on the “-” sign at the bottom left to remove them.
  3. Just select your newly added project run. If that still doesn’t work, just close the emulator and Xcode and start running again.

Linker Command failed with exit code 1 (Use-V to see Invocation)

This problem usually occurs when adding third-party library files or multi-player development. It is usually a link error caused by a file that cannot be found. We can start the investigation from the following aspects.

####1> If it is multi-user development, you will find the following error after completing synchronization.


####2> If it is a newly added third-party library, and not a static library solution: Repeat the first step, then go to Build Settings ->Linking->Other Linker Flags and change the attribute to -all_load or -objc, depending on the situation. We could have done it more than once.

####3> If you add a third-party static library (.a file)

The reason:

Build Settings ->Search Path->Library Search Paths The following figure

####4> If the above methods fail and the following error message is displayed:

Solution: Check to see if there is a new file with the same name as the previous one, and change the name of the new file. Me is XHHFormulaDetailController file name but not in a folder, so when the new added at that time did not remind, that is to say, if in the same folder, will remind whether replace files you can find yourself when the same name, but not in the same folder will be miserable.

####5> If all else fails. You can try this again: Solution: If the error message shows the name of a class, go to the original file to see which third-party libraries are included in #import, comment them out one by one, find the one that failed, and follow the official steps to add it again.

Linker command failed with exit code

## 10.__nscfNumber isEqualToString

The reason: The client often does not know the data type returned by the interface in advance. Most of the numbers are of numer type, but many times the interface will return NULL, which is interpreted as NSString when parsing, but in fact the data is of NSNumber type. On versions prior to iOS 8, you won’t get an error

[STR isEqualToString:…] [STR isEqualToString:…] . Operation. Determine as follows:

NSString *str;
if ( [object isKindOfClass:[NSNumber Class]])
    str = [object stringValue];
else if ([object isKindOfClass:[NSString Class]])
  str = object;
Copy the code

**[NSString stringWithFormat:] **

## 9. [__NSCFNumber length]: cause: this error is caused by our client to write the required current field data type of model is NSNumber, but when the dictionary model is written as NSString type

Solution: Change the required current field in the model property to an NSNumber type, perform a data conversion on the call, set the property type to NSNumber, perform a data type conversion on the call, use [NSString stringWithFormat:] to convert to NSString

We can solve the problem of invalid button clicking from the following aspects: ####1> find whether to add addSubview ####2> find frame setting in the click range area solution: The first and second steps can be used to add background color at the same time to check.

####3> If the above is not resolved, then check whether there is an imageView at the next level.

Solution: Turn on imageView interaction.

bgImageView.userInteractionEnabled = YES;
Copy the code

## 7. User security and privacy add description related issues hit a global breakpoint does not stop in the project code

For example 🌰: ####1> startup camera issues related to scanning

Cause: The access permission is not enabled when the camera is started. When the camera is invoked, it needs to be added in info.plist.

Solution: Add it to the info.plist file in Source Code mode.

####2> iOS 10’s enhancements to user security and privacy require a description when applying for multiple private permissions

Reason: iOS10 is tougher on privacy permissions. When calling camera, album, location, Bluetooth, etc., configuration is added in info.plist.


< key > NSAppleMusicUsageDescription < / key > < string > access media data < / string > < key > NSBluetoothPeripheralUsageDescription < / key > < string > access your bluetooth < / string > < key > NSCalendarsUsageDescription < / key > < string > access your calendar < / string > < key > NSCameraUsageDescription < / key > < string > access your camera < / string > < key > NSLocationAlwaysUsageDescription < / key > < string > always access your location < / string > < key > NSLocationUsageDescription < / key > < string > the location of the access to your < / string > < key > NSLocationWhenInUseUsageDescription < / key > < string > probation period the location of the access to your < / string > < key > NSMicrophoneUsageDescription < / key > <string> Access to your microphone </string> <key>NSMotionUsageDescription</key> <string> Access to Sports and Health </string> < key > NSPhotoLibraryUsageDescription < / key > < string > access your camera to film < / string > < key > NSRemindersUsageDescription < / key > <string> Access your reminder </string>Copy the code

## 6. About the UITextField unpack keyboard problem

####1> Text input box on tableViewCell Solution: this time just need to add a tap gesture on the View, if click other areas to make the View exit edit state to fold up the keyboard

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick)]; [self.view addGestureRecognizer:tap];Copy the code
[self.view endEditing:YES]; }Copy the code

####2> Text input box on the navigation bar solution: this time only need to load in View, if click other blank area to make text input box fold up the keyboard

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick)]; [self.view addGestureRecognizer:tap];Copy the code
Void tapClick {[self.searchBar resignFirstResponder]; // Close the first responder}Copy the code

####3> Text input box and check item in the tableView layout of the same page when it is necessary to click select or unselect, the gesture adding method above is no longer feasible, there will be conflict. Solution: You can choose to add the view exit edit effect by clicking the current row effect.

// Select the current row - (void)tableView (UITableView *)tableView didSelectRowAtIndexPath (NSIndexPath *)indexPath {XHHPremixModel *model = self.list[indexPath.row]; // Handle checkability problem, select the value of 1if ([model.unit isEqualToString:@"1"] {// Select model.selected =! model.selected; [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; } // Exit the editing state (close the keyboard) [self.view endEditing:YES]; }Copy the code

The tableViewCell can trigger a click, and the superview of the TableView has click recognition, so there will be a conflict when clicking. The solution is to distinguish between gestures in the GestureRecgnizer agent method.

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick)]; [self.view addGestureRecognizer:tap]; tap.delegate = self; // Set proxy to resolve gesture conflictsCopy the code

Solution: the controller UIGestureRecognizerDelegate comply with the agreement, to achieve the following method

# pragma mark tapGestureRecgnizerdelegate resolve conflicts gestures
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
    //NSLog(@"Gesture-triggered class = %@",NSStringFromClass([touch.view class])); / / if UITableViewCellContentView (i.e., click the tableViewCell), are not intercept Touch events / / click tableViewCell does not perform Touch eventsif ([touch.view isKindOfClass:[UITableView class]]){
    return NO;
     if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
        return NO;
    return  YES;
Copy the code

## 4. UI does not refresh data in time solution: need to do corresponding operation in the main thread to send notification to update

- (void)setUnreadMessageNum:(int)unreadMessageNum { _unreadMessageNum = unreadMessageNum; Dispatch_async (dispatch_get_main_queue()) ^{ [[NSNotificationCenter defaultCenter] postNotificationName:ZH_Notification_isChangedUnreadMessageNum object:nil]; }); }Copy the code

## 3. Crashes occur when multiple partitions are requested on a page using different models. [XHHNewTecProModel materialName]: Unrecognized selector sent to instance 0x60000042DCE0 2017-03-24 10:39:06.356 ZLFeed[25691:1317187] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[XHHNewTecProModel materialName]: unrecognized selector sent to instance 0x60000042dce0’ *** First throw call stack:

Solution: Do not flush the entire data in request 6. Do not use the reloadData method. Just refresh the current partition.

NSIndexSet *indexSet = [[NSIndexSet alloc]initWithIndex:0]; // Refresh only one section NSIndexSet *indexSet = [[NSIndexSet alloc]initWithIndex:0]; [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];Copy the code

## 2. For the problems related to APP launch failure, please take steps: “Tragedy” of iOS APP launch rejection

For iOS 10 related questions, please go to: Compatible with iOS 10, organize notes