iOS 问题收集及处理 (弃用方法收集)持续更新中(warning,errors)

  • 1.warning
  • 2.errors
  • 3.真机运行

warning:(报黄⚠️)

1.CGSize sz = [message sizeWithFont:ft constrainedToSize:CGSizeMake(250, 1000)];

2.NSArray*ifs = (__bridgeid)CNCopySupportedInterfaces();
id info = nil;

for (NSString *ifnam in ifs) {

    info = (__bridge id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);

    if (info && [info count]) {

        break;

    }

}
3.constrainedToSize

CGSize sz = [message sizeWithFont:ft constrainedToSize:CGSizeMake(250, 1000)];
alertView 弃用 (UIAlertController 代替)

4. ABPeoplePickerNavigationController iOS 9.0之后弃用

这里写图片描述

代替方案:
引用—–>

#import <ContactsUI/CNContactViewController.h>
#import <ContactsUI/CNContactPickerViewController.h>

这里写图片描述

5.stringByAddingPercentEscapesUsingEncoding iOS9.0后弃用
NSString *str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

这里写图片描述

解决方案:

    NSString *string = @"hahahaha";
    NSString *Urlstring = [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLUserAllowedCharacterSet]];

这里写图片描述

6.UIAlertView (iOS9.0后弃用)
 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
    [alert show];

同时弃用的还有 UIActionSheet (iOS 8.3 后弃用)

 UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"收款" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"保存", nil];
    actionSheet.tag = 105;
    [actionSheet showInView:self.view];

这里写图片描述

7.interfaceOrientation (iOS8.0后弃用)
    UIInterfaceOrientation toInterfaceOrientation = self.interfaceOrientation;

    if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
        [self remasMakeForVertical];
    }else{
        [self remasMakeForLandscape];

    }

这里写图片描述

8.applicationFrame(iOS 9.0 后弃用)
screenshotImgView.frame = [UIScreen mainScreen].applicationFrame;

这里写图片描述

————–分割————–

errors:(报红)

真机调试问题

1.launchscreen 黑屏问题

可能原因: 真机运行内存较小,launchscreen图片过大
解决方法: 删除掉原先的launch screen 重新建立一个launchscreen.storyBoard (iOS 8.0以下 位launchscreen.xib) 重新建立后运行成功.
希望有哪位大神可以解释下原因.

发布了36 篇原创文章 · 获赞 6 · 访问量 7万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章