Xcode8以及iOS10问题记录
2017-05-23 11:20
447 查看
Xcode8以及iOS10问题记录
分类:iOS项目开发(5122) (2) 举报 收藏
1.解决工程中输出无关日志
EditScheme -> Run -> Arguments, 在Environment Variables里边添加
OS_ACTIVITY_MODE disable
遗留问题:
还会出现下面这个问题
5]:
Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x112b58910)
and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x112982210). One of the two will be used. Which one
is undefined.
2.注释快捷键⌘+/失效
重启电脑,如果还不能使用的话就启用命令工具(命令运行 sudo/usr/libexec/xpccachectl),然后重启电脑
3.对于插件无法使用
网上推荐的是将Xcode拷贝一份可以使用插件的Xcode(在应用程序中),但是这个Xcode不能打包上传等,建议不要使用这种方法三方插件解决方法(fix
method):让你的Xcode8继续使用插件
4.iOS10隐私权限问题
iOS10中调用相机相册等系统功能时,需要在info.plist文件中添加字段,否则会出现闪退的情况[html] view
plain copy
<!-- 相册 -->
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<!-- 相机 -->
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<!-- 麦克风 -->
<key>NSMicrophoneUsageDescription</key>
<string>App需要您的同意,才能访问麦克风</string>
<!-- 位置 -->
<key>NSLocationUsageDescription</key>
<string>App需要您的同意,才能访问位置</string>
<!-- 在使用期间访问位置 -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>App需要您的同意,才能在使用期间访问位置</string>
<!-- 始终访问位置 -->
<key>NSLocationAlwaysUsageDescription</key>
<string>App需要您的同意,才能始终访问位置</string>
<!-- 日历 -->
<key>NSCalendarsUsageDescription</key>
<string>App需要您的同意,才能访问日历</string>
<!-- 提醒事项 -->
<key>NSRemindersUsageDescription</key>
<string>App需要您的同意,才能访问提醒事项</string>
<!-- 运动与健身 -->
<key>NSMotionUsageDescription</key> <string>App需要您的同意,才能访问运动与健身</string>
<!-- 健康更新 -->
<key>NSHealthUpdateUsageDescription</key>
<string>App需要您的同意,才能访问健康更新 </string>
<!-- 健康分享 -->
<key>NSHealthShareUsageDescription</key>
<string>App需要您的同意,才能访问健康分享</string>
<!-- 蓝牙 -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App需要您的同意,才能访问蓝牙</string>
<!-- 媒体资料库 -->
<key>NSAppleMusicUsageDescription</key>
<string>App需要您的同意,才能访问媒体资料库</string>
iOS10 配置须知
5.label中的文字显示不全
Xcode8与Xcode7.3的文字宽度变化(英文字母没有问题,只有汉字有问题)
6.Notification(通知)
(1)所有相关通知被统一到了UserNotifications.framework框架中(2)增加了撤销、更新、中途还可以修改通知的内容
(3)通知不再是简单的文本,现在还可以是图片、视频,自定义通知的展示等等
(4)iOS10相对之前的通知来说更好用更易于管理,并且进行了大规模优化
(5)iOS10之后,本地与远程通知集成在一个方法中
7.ATS问题
iOS10从2017年1月1日起只能使用HTTPS,否则提交App可能会被拒绝。
8.iOS10中UICollectionView性能优化
WWDC2016Session笔记 - iOS 10 UICollectionView新特性
9.iOS10
UIColor新增方法
iOS10苹果建议我们使用sRGB,因为它性能更好,色彩更丰富。[html] view
plain copy
+ (UIColor *)colorWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);
- (UIColor *)initWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);
10.iOS10
UIScrollView新增refreshControl
也就是说以后只要是继承UIScrollView就支持刷新功能[html] view
plain copy
@property (nonatomic, strong, nullable) UIRefreshControl *refreshControl NS_AVAILABLE_IOS(10_0) __TVOS_PROHIBITED;
[objc] view
plain copy
- (void)viewDidLoad {
[super viewDidLoad];
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 500)];
scrollView.backgroundColor = [UIColor redColor];
scrollView.contentSize = CGSizeMake(self.view.bounds.size.width, 1000);
[self.view addSubview:scrollView];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1"]];
[scrollView addSubview:imageView];
// 添加下拉刷新控件
UIRefreshControl *ref = [[UIRefreshControl alloc] init];
// 监听刷新方法
[ref addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
scrollView.refreshControl = ref;
self.view.backgroundColor = [UIColor redColor];
}
- (void)refresh:(UIRefreshControl *)ref {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(22 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 结束刷新
[ref endRefreshing];
});
}
11.iOS10判断系统版本
[html] viewplain copy
NSLog(@"%zd\n%f\n%@",
[[[[UIDevice currentDevice] systemVersion] substringToIndex:1] integerValue],
[[UIDevice currentDevice] systemVersion].floatValue,
[[UIDevice currentDevice] systemVersion]);
12.UIStatusBar的问题
在iOS10中,如果还是用以前设置UIStatusBar类型或者控制隐藏还是显示的方法,会报警告,方法过期,如下图:要想修改UIStatusBar的样式或者状态使用下图中所示的属性或方法:
[html] view
plain copy
@property(nonatomic, readonly) UIStatusBarStyle preferredStatusBarStyle NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED; // Defaults to UIStatusBarStyleDefault
@property(nonatomic, readonly) BOOL prefersStatusBarHidden NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED; // Defaults to NO
- (UIStatusBarStyle)preferredStatusBarStyle NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED; // Defaults to UIStatusBarStyleDefault
- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED; // Defaults to NO
// Override to return the type of animation that should be used for status bar changes for this view controller. This currently only affects changes to prefersStatusBarHidden.
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED; // Defaults to UIStatusBarAnimationFade
13.UITextField新增字段
在iOS10中,UITextField新增了textContentType字段,是UITextContentType类型,它是一个枚举,作用是可以指定输入框的类型,以便系统可以分析出用户的语义,是电话类型就建议一些电话,是地址类型就建议一些地址。可以在#import<UIkit/UITextInputTraits.h>文件中,查看textContentType字段,有以下可以选择的类型:[html] view
plain copy
UIKIT_EXTERN UITextContentType const UITextContentTypeName NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeNamePrefix NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeGivenName NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeMiddleName NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeFamilyName NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeNameSuffix NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeNickname NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeJobTitle NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeOrganizationName NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeLocation NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeFullStreetAddress NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeStreetAddressLine1 NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeStreetAddressLine2 NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeAddressCity NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeAddressState NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeAddressCityAndState NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeSublocality NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeCountryName NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypePostalCode NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeTelephoneNumber NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeEmailAddress NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeURL NS_AVAILABLE_IOS(10_0);
UIKIT_EXTERN UITextContentType const UITextContentTypeCreditCardNumber NS_AVAILABLE_IOS(10_0);
14.推送
所有的推送平台,不管是极光还是什么的,要想收到推送,这个必须打开
15.蓝牙相关
CBCentralManagerState废弃,使用CBManagerState替代CBCentralManager直接继承于CBManager,里面直接声明的属性:
@property(nonatomic, assign, readonly) CBManagerState state;
16.openURL的方法被遗弃,使用其替换方法
openURL:options:completionHandler:
17.iOS10字体随着手机系统字体而改变
iOS10提供了这样的属性adjustsFontForContentSizeCategory来设置
[html] view
plain copy
UILabel *myLabel = [UILabel new];
// UIFont 的preferredFontForTextStyle:意思是指定一个样式,并让字体大小符合用户设定的字体大小
myLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
myLabel.adjustsFontForContentSizeCategory = YES; // 是否更新字体的变化
原文地址 http://blog.csdn.net/floatingdreamsh/article/details/52605346
相关文章推荐
- Xcode8以及iOS10问题记录
- Xcode8以及iOS10问题总结!
- [置顶] 升级iOS10和Xcode8遇到问题以及解决办法
- Xcode8以及iOS10问题总结!
- Xcode8以及iOS10适配等常见问题汇总(整理篇)
- 摩托罗拉SE4500 三星 S3C6410 Wince6.0平台软解码调试记录以及驱动相关问题解释
- 解决Apache的错误日志巨大的问题以及关闭Apache web日志记录
- appfuse2.2.1搭建并运行,以及碰到的一些列问题记录
- appfuse2.2.1搭建并运行,以及碰到的一些列问题记录
- 从今天开始记录一下每天学到的Android知识、以及开发中遇到的问题
- 记录IOS开发中遇到的问题以及解决方法
- IOS开发过程中Xcode编译错误以及运行时异常等问题记录
- stunnel+haproxy SSL以及问题记录
- 使用gyp构建项目,使用ninja更快的编译,以及使用出现和解决的问题记录
- lnmp Proftpd 无法登陆以及 安装Discuz问题记录
- 使用gyp构建项目,使用ninja更快的编译,以及使用出现和解决的问题记录
- 本文章用于记录平常所遇到的问题以及解决方法
- stunnel+haproxy SSL以及问题记录
- javascript以及jquery诡异问题全记录(持续更新)