iOS11 添加的部分特性(转贴) + Xcode9 无线调试

1.相册权限需要增加,不然会造成闪退哟
增加info.Plist中的字段:
之前的这个字段:Privacy - Photo Library Usage Description
需要增加这个字段Privacy - Photo Library Additions Usage Description,内容和上面字段保持一致即可。
2.UITableViewStyleGrouped样式的UITableViewsectionHeadersectionFooter有一个默认的高度,通常不需要显示header或者footer的时候,会这么写

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  return CGFLOAT_MIN;
}
 
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
  return CGFLOAT_MIN;
}

但是在iOS11里面你会发现段头段尾又回来辣!改了各种新增的属性比如safeArea之类的一点用都没有,最后发现必须要把estimatedSectionHeaderHeight置0才变回去
3.在iOS11中,苹果开放了NFC(Near field communication),怕也是其推广ApplePay的一种策略。
在使用近场通讯时,首先也要在info.plist配置NFCReaderUsageDescription权限,案例步骤,如下:
iOS 11 Core NFC - any sample code?
4.如果您在Navigation上的titleView上添加searchBar,iOS11情况下可能有问题

- (void)resetSearchBar
{
  CGFloat leftButtonWidth = 35, rightButtonWidth = 75; // left padding right padding
  UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width - leftButtonWidth - rightButtonWidth, 44)];
 
  self.searchBar.translatesAutoresizingMaskIntoConstraints = NO;
  [container addSubview:self.searchBar];
 
  CGFloat offset = (rightButtonWidth - leftButtonWidth) / 2;
  // 给searchBar添加约束
  [NSLayoutConstraint activateConstraints:@[
                       [self.searchBar.topAnchor constraintEqualToAnchor:container.topAnchor], // 顶部约束
                       [self.searchBar.leftAnchor constraintEqualToAnchor:container.leftAnchor constant:-25*ScreenScaleX], // 左边距约束
                       [self.searchBar.rightAnchor constraintEqualToAnchor:container.rightAnchor constant:0], // 右边距约束
                       [self.searchBar.bottomAnchor constraintEqualToAnchor:container.bottomAnchor], // 底部约束
                       [self.searchBar.centerXAnchor constraintEqualToAnchor:container.centerXAnchor constant:-offset], // 横向中心约束
                       //                       [self.searchBar.widthAnchor constraintEqualToAnchor:container.widthAnchor constant:width] // 宽度约束
                       ]];
  self.navigationItem.titleView = container; // 顶部导航搜索
}
Xcode9 无线调试
  • 软硬件要求:
  - Xcode 9.0 beat 及以上版本
  - macOS 10.12.5 及以上版本
  - iOS 11.0 beat 及以上版本
  • 连接要求
电脑和设备处于同一 Wifi 环境

虽然Xcode支持无线调试, 但让你的设备支持无线调试之前, 必须连接上数据线, 做好相应配置

 1.  通过数据线将您的设备,连接至Xcode.
 2.  打开菜单栏 `Window > Devices and Simulators`, 然后在打开的菜单中 `选择 Devices选项`.或者直接按command+shift+2
 3.  按下图点选

随后你的设备右侧会出现一个球状标识, 到此你就可以拔掉数据线, 开始无效调试咯

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容