最近下载Xcode8 ,把项目适配了一下iOS10 ,把遇到的一些问题记录下来:
1.Xcode8运行项目之后,控制台打印了一堆东西;
去除方法:选择Xcode ->Product ->Scheme -> Edit Scheme 或者按command + shift + < 快捷键,
在弹出的窗口中Environment Variables 下添加 0S_ACTIVITY_MODE=disable
注:真机调试不输出NSlog了,所以我真机调试的时候,把此处对号去除,就好了
2.Xcode8 打开工程后,出现下图,苹果新特性
我勾选了Automatically manage signing,并且选择配置了Team,就好了。
注:或者另外一种方式 点击打开链接
3.用Xcode8 运行项目在真机上,打开相机相册功能,程序崩溃;
解决办法:项目中访问了隐私数据,需要在info.plist中添加这些权限:
相机权限
<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
相册权限
<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>
注:
<!-- 相册 -->
<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>
如果没有用,需配置一下
4.字体变大,原有的fream需要适配,智能逐一排查啦
5.Nib问题:警告
- (void)awakeFromNib {
// Initialization code
}
需要添加:
[super awakeFromNib];
6. UIApplication对象中openUrl被废弃
#define LIOS10_OR_LATER ([[[UIDevice currentDevice]systemVersion]compare:@"10.0" options:NSNumericSearch] !=NSOrderedAscending)
8.代码注释不能用
然后必须重启电脑后生效
Dear developer,
We have discovered one or more issues with your recent delivery for "APPName". To process your delivery, the following issues must be corrected:
This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
Once these issues have been corrected, you can then redeliver the corrected binary.
Regards,
The App Store team