Summarize the various pits for iOS 8 and Xcode 6

Source: Internet
Author: User

Summarize the various pits for iOS 8 and Xcode 6

Project Path Pit

The path of the simulator moved from the previous ~/library/application Support/iphone Simulator to the ~/library/developer/coresimulator/devices/which was quite the pit-father, Before running with which emulator directly select the emulator folder to go to find the project

Now, the devices directory does not indicate the version of the simulator, the image of the corresponding may be selected on the iphone 5s 7.1

Then the picture on the folder corresponds to the iphone 4s 7.1 iphone 4s 8.0 iphone 5s 7.1 iphone 5s 8.0 ..., but I don't know which one corresponds, okay, I'm going crazy.

Nsuserdefaults Pit

I try to delete the iphone 4s, iphone 5s, by nsuserdefaults the data stored locally, after the emulator has deleted the app, clean it, and can't erase the data. The same project inside, or no solution, this should be a bug, and so on Apple update Xcode (I currently use 6.0). But there's no such thing as a real machine (it must be)

UITableView Pit

Interface with UITableView if the following warning is encountered

Warning once only:detected a case where constraints ambiguously suggest a height of zero for a tableview cell ' s content V Iew. We ' re considering the collapse unintentional and using standard height instead.

Add the following code to resolve

1 self.tableView.rowHeight = 44.0f;

AutoLayout Pit

A typical uitabbarcontroller as the root view, and then click on one of the page buttons to push to a list page case, structure as

If you need to hide Tabbar on the list page, then I usually set Bottombar to none in this VC so as to better constrain the layout.

But...... When debugging, you will find a Tabbar height view at the bottom of the moment you enter the list page. Or just be honest with the default inferred.

The keyboard can't bounce.

Deselect Connect Hardware Keyboard

Detailtextlabel cannot be displayed

Let's start with the following code.

1234567891011121314151617181920 - (void)viewDidLoad{  [superviewDidLoad];  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{    self.array = @[@"测试"];    [self.tableView reloadData];  });}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{  return1;}- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{  return1;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TradeRecordCell"                              forIndexPath:indexPath];  cell.detailTextLabel.text = _array[indexPath.row];  return cell;}

The code is fine, under iOS 7, a second after the cell's Detailtextlabel will display the test two words, but in iOS 8 but not detailtextlabel display empty. The test found that when Detailtextlabel's text starts empty, IOS 8 will set the size of the label (0, 0) so that it does not display correctly, because Cell.detailTextLabel.text = _array[ Indexpath.row]; The first data is empty, the solution:

If it's empty, don't set the value.

123 if(_array[indexPath.row]) {        cell.detailTextLabel.text = _array[indexPath.row];    }

Or

1 cell.detailTextLabel.text = _array[indexPath.row] ? : @" ";

PCH file is missing.

Now the project created by Xcode 6 is not with the PCH file by default, and of course the older version of the project is preserved. So how do I add a PCH file?

* Command + N then select PCH File in other

* Find Prefix Header in Build settings

* Add PCH file, the rule is: project name/xxxxx.pch

Uialertview's pit.

Uialertview long text problem with untitled

12 UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:nil message:@"远端Git仓库和标准的Git仓库有如下差别:一个标准的Git仓库包括了源代码和历史信息记录。我们可以直接在这个基础上修改代码,因为它已经包含了一个工作副本。"delegate:self cancelButtonTitle:@"知道了"otherButtonTitles:nil, nil];[alterView show];

The above code looks like this in iOS 8, the content is completely top to the top, the text is also inexplicably bold

I'll tell you what, just set the title to @ "" right?

12 UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@""message:@"远端Git仓库和标准的Git仓库有如下差别:一个标准的Git仓库包括了源代码和历史信息记录。我们可以直接在这个基础上修改代码,因为它已经包含了一个工作副本。" delegate:self cancelButtonTitle:@"知道了"otherButtonTitles:nil, nil];[alterView show];
Scan to subscribe to daily mobile development and app promotion hot News
Public Number: Cocoachina

Summarize the various pits for iOS 8 and Xcode 6

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.