macOS Sierra || ios10 || xcode8||问题汇总


1.修复任何来源选项
安装macOS Sierra后,会发现系统偏好设置的“ 安全与隐私”中默认已经去除了允许“任何来源”App的选项, 无法运行一些第三方应用。



如果需要恢复允许“任何来源”的选项,即关闭Gatekeeper,请在终端中使用spctl命令:
sudo spctl --master-disable,切换权限会打开Gatekeeper,
需重新打开命令
附:
sudo spctl --master-disable 关闭
sudo spctl --master-enable 激活
csrutil status  查询状态
或者按住 ctrol 点击安装包或程序同样可以安装


2.项目报如下错误:

 app:resource fork, Finder information, or similar detritus not al site:forums.developer.apple.com......

   (1)关闭Xcode,打开终端;

(2)在终端中输入cd(cd后跟一个空格,先不慌张按回车);

(3)打开项目的文件夹,文件夹中有四个文件,一个.md文件,一个.xcodeproj文件,一个工程文件和一个带有Tests单词的文件。将工程文件拉到终 端中(知道路径的可以在c的后面直接敲路径),路径会自动显示出来,这时直接按回车键;

(4)输入指令“xattr -rc .”,回车;

(5)打开项目重新运行,OK了!

3.上传 AppStore报错:

ERROR ITMS-90529: "Invalid package. Applications built with sdk 9.0 or later must be packaged as proper IPA files."

按照错误提示原先上传的是.zip文件,现在需要上传 .ipa文件。也就是需要将打包成的app在打包成ipa文件就可以了。
具体步骤:
1、新建文件夹 Payload 
2、将xcode编译好的app放在Payload文件夹中
3、压缩Payload文件夹为 .zip文件,然后重命名为 .ipa

4.上传 AppStore报错:
 ERROR ITMS - 90167 No. app bundles found in the package

升级macOS Sierra 10.12 系统后必须在application loader 3.6及以上版本才能上传,所以必须用 xcode8.0版本上传,也可以按一下方法试一试:

1、先使用 Xcode7.3.1 打包。

2、选中打好的包,“show in Finnder”, 有个 “xx.xcarchive”,选中它 显示包内容,然后是:”Products”–>”Applications”,这里有一个 “xx.app”,选中它显示包内容。找到 “info.plist”,修改 “info.plist” 中 “BuildMachineOSBuild” 键所对应的值为:”16A323”, 修改 “DTXcodeBuild” 键所对应的值为 “8A218a”, 然后用 “Xcode8”(我用的是Xcode8 beta版) 或者 “Application Loader” 提交。


5.使用Xcode8上传成功后,商店里构建版本却没有应用,及打开相机等系统功能闪退

这是因为iOS对用户的安全和隐私的增强,在申请很多私有权限的时候都需要添加描述,但是,在使用Xcode 8之前的Xcode还是使用系统的权限通知框.
要想解决这个问题,只需要在 info.plist添加 NSContactsUsageDescription的key, value,用到那个写那个
<!-- 相册 -->
<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>

6.推送 相关

需打开下图,第三方更新最新版 sdk

ios7及以下版本推送方法

- ( void )application:(UIApplication *)application didReceiveRemoteNotification:
( NSDictionary *)userInfo {}

 ios8到 ios9.3

- ( void )application:(UIApplication *)application didReceiveRemoteNotification:( NSDictionary *)userInfo fetchCompletionHandler:( void (^)(UIBackgroundFetchResult))completionHandler {}

ios10.0及以后
- ( void )jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:( void (^)( NSInteger ))completionHandler {}

- ( void )jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:( void (^)())completionHandler {}

7.xcode8.0 nslog打印很多没用信息
法一:加入一些过滤语句
#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"%s\n",[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSLog(...)
#endif
二:设置OS_ACTIVITY_MODE : disable如下图
:

8.字体适配的问题

ios 9 之前的lab 字体可以显示全,但是到了ios10 发觉字体显示不全了.得适配啊.app 会跟随手机系统字体大小而改变了.

简单粗暴地方法就是不让他跟着手机系统的字体改变而改变.

label.adjustsFontForContentSizeCategory = YES;


UILabel *myLabel = [UILabel new];
/*UIFont 的preferredFontForTextStyle: 意思是指定一个样式,并让字体大小符合用户设定的字体大小。 */
myLabel.font =[UIFont preferredFontForTextStyle: UIFontTextStyleHeadline];
 /*
 Indicates whether the corresponding element should automatically update its font when the device’s UIContentSizeCategory is changed.
 For this property to take effect, the element’s font must be a font vended using +preferredFontForTextStyle: or +preferredFontForTextStyle:compatibleWithTraitCollection: with a valid UIFontTextStyle.
 */
//是否更新字体的变化
myLabel.adjustsFontForContentSizeCategory = YES;


9.xcode8的注释快捷键注释不能用了,   command+/ 不行了

因为苹果解决xcode ghost。把插件屏蔽了。解决方法
命令运行: sudo /usr/libexec/xpccachectl
然后必须重启电脑后生效

10.判断版本问题

OC建议使用[[UIDevice currentDevice] systemVersion]

#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
swift 使用  if #available( ios 10.0,*){ //是10.0 }else{//不是10.0}


11. ios10.0新增 UIRefreshControl类

在iOS 10 中, UIRefreshControl可以直接在UICollectionView和UITableView中使用,并且脱离了UITableViewController.现在RefreshControl是UIScrollView的一个属性.
使用方法:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(loadData) forControlEvents:UIControlEventValueChanged];
collectionView.refreshControl = refreshControl;

12.UIStatusBar方法过期

//属性&&方法
@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

//可以这样写
- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleDefault;
}


iOS 10 苹果官方文档



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值