레이블이 iOS 9인 게시물을 표시합니다. 모든 게시물 표시
레이블이 iOS 9인 게시물을 표시합니다. 모든 게시물 표시

Application windows are expected to have a root view controller at the end of application launch

에러 코드

Xcode 7 iOS9에서 발생
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException'reason : 'Application windows are expected to have a root view controller at the end of application launch'


원인

Xcode 7부터 앱 시작전에 root view controller를 설정해 주어야 합니다.


해결

-  ( BOOL ) application : ( UIApplication  * ) Application  didFinishLaunchingWithOptions : ( NSDictionary * ) launchOptions {
    // 윈도우 초기화
    self . window  =  [[ UIWindow  alloc ]  initWithFrame : [ UIScreen  MainScreen ]  bounds ]];
    self . window . rootViewController  =  [ UIViewController  new ];
    [ self . window  makeKeyAndVisible ];

    return  YES ;
}



App Transport Security

iOS9 혹은 OS X 10.11이상에서 유효한 기능이며, 어플이나 웹서비스 간의 안전한 연결을 위해 사용할 수 있습니다.

ATS가 활성화 되면 HTTP통신을 할 수 없습니다. 또한 Apple에서 권장하는 요구 사항을 충족하지 않는 연결은 강제로 연결 실패 처리 됩니다.



실제 에러 메시지

Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSErrorFailingURLStringKey=에러가 발생한 URL, NSErrorFailingURLKey=에러가 발생한 URL, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSUnderlyingError=0x14eae740 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSErrorFailingURLKey=에러가 발생한 URL, NSErrorFailingURLStringKey=에러가 발생한 URL, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}}}




필요조건

  • TLS버전 1.2 이상
  • 연결시 사용할수 있는 암호화스위트(암호화 알고리즘의 조합)는 다음 리스트로 제한
    • TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
    • TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
    • TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
    • TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
    • TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
    • TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
    • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
    • TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
    • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
    • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
  • 서버인증서에 요구되는 조건
    • SHA256 이상의 지문
    • 2048 비트 이상의 RSA 키 또는 256 비트 이상의 Elliptic-Curve(ECC)키
  • 잘못된 인증서를 사용하면 강제로 실패되어, 연결할 수 없음



필요조건을 만족시킬 수 없는 경우

Info.plist에 특정 키와 값을 추가하면 ATS를 비활성화하거나 일부 동작을 변경할 수 있습니다.


ATS를 비활성화 (비추천)
<key> NSAppTransportSecurity </ key>
<dict>
    <key> NSAllowsArbitraryLoads </ key>
    <true />
</ dict>


기본적으로 ATS를 활성화 하고 ATS의 대상으로 하지 않는 도메일을 Info.plist에 기재
<key> NSAppTransportSecurity </ key>
<dict>
    <key> NSExceptionDomains </ key>
    <dict>
        <key> 예외처리할 도메인 </ key>
        <dict>
            <key> NSTemporaryExceptionAllowsInsecureHTTPLoads </ key>
            <true />
        </ dict>
    </ dict>
</ dict>


기본적으로 ATS를 무효로하고, ATS의 대상으로하는 도메인을 Info.plist에 기재
<key> NSAppTransportSecurity </ key>
<dict>
    <key> NSAllowsArbitraryLoads </ key>
    <true />
    <key> NSExceptionDomains </ key>
    <dict>
        <key> 예외처리할 도메인 </ key>
        <dict>
            <key> NSTemporaryExceptionAllowsInsecureHTTPLoads </ key>
            <false />
        </ dict>
    </ dict>
</ dict>


ATS의 요구사항을 낮출 설정을 Info.plist에 기재
<key> NSAppTransportSecurity </ key>
<dict>
    <key> NSExceptionDomains </ key>
    <dict>
        <key> 도메인 </ key>
        <dict>
            <key> NSTemporaryExceptionMinimumTLSVersion </ key>
            <string> TLSv1.1 </ string>
            <key> NSTemporaryExceptionRequiresForwardSecrecy </ key>
            <false />
        </ dict>
    </ dict>
</ dict>