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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章