はじめに

2015年9月16日にios9がリリースです。
伴ってアプリ側もios9対応と前々から言われているipv6対応をしていく必要があるので参考となる情報を載せておきます。
iOS9も動作保障するのであれば一旦ビルドして早急に確認しましょう

iOS9ユーザ視点新機能:
http://www.apple.com/jp/ios/whats-new/

iOS9日本公開日時は17日の午前2時を予定
http://www.timeanddate.com/worldclock/fixedtime.html?msg=iOS+9&iso=20150916T10&p1=224

iOS9対応/ipv6対応について記事を載せてる参考サイト

公式
https://developer.apple.com/library/prerelease/ios/navigation/

リリース内容公式(ios9.0)
https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html

リリース内容公式(ios9.1)
https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9_1.html

apns(2015WWDCより)
http://odecee.com.au/wwdc-2015-big-changes-to-apple-push-notifications/

iOS9 で必要な IPv6 only Network への対応
http://qiita.com/shao1555/items/4433803419dfc72bf80b

秋のiOS 9対応リリースに向けて、iOSアプリ開発者が今からやっておくべきことまとめ
http://qiita.com/mono0926/items/e7c4ca0bf0f5196b88a2

【追記】iOS9でHTTP通信がSSL通信になるのを防ぐ方法
http://nlogic.jp/?p=412

iOS9 ATS問題
http://qiita.com/yanayanalte/items/e6d83c12af77fa238a58

[iOS 9] iOS 9 で追加された App Transport Security の概要
http://dev.classmethod.jp/smartphone/iphone/ios-9-intro-ats/

【iOS9】API Diffs から見る iOS 9 の新機能
http://d.hatena.ne.jp/shu223/20150609/1433813938

開発者向けiOS 9、WatchOS 2、Swift 2、Xcode 7の新機能と新しいApple Developer Programの参考情報まとめ
http://www.atmarkit.co.jp/ait/articles/1507/24/news025.html

iOS9 SDKでDeprecatedになるもの。
http://quesera2.hatenablog.jp/entry/2015/06/29/001035

iOS 9の「Search API Best Practices and FAQs」が公開されたので読み解いてみた
http://qiita.com/mono0926/items/27af791065ed919255e0

iOS9のWebviewでNSURLErrorDomainとなる場合の対処法(ATS)
http://qiita.com/peromasamune/items/f5b72c4dbd33b5019611

UIWebViewでhttpなURLにアクセスしようとしたら代わりにSFSafariViewControllerで開くようにする
http://qiita.com/bricklife/items/ac92be3e33c7c9eaca9b

iOS9対応について

iOS9対応を行い、これからiOS9へ移行したユーザでも使用できるようにアプリも移行作業を進めましょう
まずXcodeで[Base SDK]をiOS9.0に設定しビルドします。
ここでビルドエラーになった場合に、エラー箇所を修正していきます。

公式資料:
https://developer.apple.com/library/prerelease/ios/navigation/

XCode 7 への移行について

2015/9/11時点では9/9のXcode 7.1 beta版が最新版です。
iOS9はXcode6でビルド可能です、XCode7の機能を使う予定がなければ、正式リリースされたあとで入れてもいいと思います。

XCode7公式情報:
https://developer.apple.com/library/prerelease/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_7_0.html

XCodeバージョン情報:
https://developer.apple.com/xcode/download/

iOS9で変更(非推奨)APIの修正について

swift/objective-cで追加や非推奨となるAPI一覧が出ているため、更新されたAPIはios9用にしてあげるといいです。
非推奨なので基本的には使えるはずですがいずれ使えなくなる可能性があります。
swiftのメソッドは非推奨ではなくremoveになっているのが結構あるので別途用意されている代わりのメソッドに移行する必要があります。
https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS90APIDiffs/index.html

ATS(App Transport Security)について

公式より、ios9とOS X 10.11からサーバとアプリ間のネットワークはセキュア(https)なアクセスを行う機能とのことです。デフォルト設定でオンになっているのでhttpでもアクセスできるようにするにはATSの機能をオフ設定にして設定を上書きしないといけなくなりました。
Xcodeで[Base SDK]をiOS9.0に設定してビルドするとATSがデフォルトでONになるので、この設定を行わない限りは既存アプリでOSをiOS9にアップグレードしてもアプリはエラーにはなりません。

公式資料:
https://developer.apple.com/library/prerelease/mac/technotes/App-Transport-Security-Technote/index.html

App Transport Security is a feature that improves the security of connections between an app and web services. The feature consists of default connection requirements that conform to best practices for secure connections. Apps can override this default behavior and turn off transport security.

Transport security is available on iOS 9.0 or later, and on OS X 10.11 and later.

ユーザ情報などのセキュアにするべきデータを扱うアプリ(サービス)では、すでにSSL対応はしていても、公に公開されているRSSデータのやり取りなどではSSL対応していない場合が多いとおもいます。
今回のATS機能により対象がすべてのサーバAPIのデータ・WebViewに表示しているサーバサイト自体もすべてSSL対応したサイトへのアクセス以外は受け付けなくなります。

対応方法は以下3点のいずれかになります

  • サーバをSSL対応する(httpsでアクセスできるようにする)
  • ATSで対象サーバのみ無効にする(Info.plistファイルを編集して対応可能)
  • ATS自体を無効にする(Info.plistファイルを編集して対応可能) ※リジェクトされる可能性あるのでやめたほうが無難

サーバ側で対応する場合はTLSプロトコルの1.2以上をサポートする必要があります

The server must support at least Transport Layer Security (TLS) protocol version 1.2.
Connection ciphers are limited to those that provide forward secrecy (see the list of ciphers below.)
Certificates must be signed using a SHA256 or better signature hash algorithm, with either a 2048 bit or greater RSA key or a 256 bit or greater Elliptic-Curve (ECC) key.
Invalid certificates result in a hard failure and no connection.

アプリの設定ファイルInfo.plistファイルでデフォルトのセキュアなアクセスを上書きして変更することができます

You can specify exceptions to the default behavior in the Info.plist file in your app or extension. Use the keys in the property list for specific exceptions or to turn off App Transport Security.

ATSを有効状態で対象サーバのみ無効にするにはInfo.plistに以下のように指定すると良いようです。

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>[無効にするサーバドメイン]</key>
        <dict>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

NSExceptionDomainsで例外(無効)にするドメインを指定します

NSExceptionDomains
A dictionary of App Transport Security exceptions for specific domains. Each key is a string containing the domain name for the exceptions.

指定の詳細は公式資料を参考ください

ipv6対応について

App Storeの審査で、現行はipv4/ipv6の何れかまたは両方の対応があるアプリはリリース可能でしたが、
今後はIPv6対応をしていないものはリリースできなくなります。
サーバ,キャリアがipv6対応していればとくに、アプリ内で対応はだいたいのアプリで不要となりますがipv4に依存している場合に修正が必要になるので以下項で記載します。
公式資料に移行手順が書いてあります。

公式資料:
https://developer.apple.com/library/
https://developer.apple.com/videos/wwdc/2015/?id=719
http://devstreaming.apple.com/videos/wwdc/2015/719ui2k57m/719/719_your_app_and_next_generation_networks.pdf

ipv4アドレスを直接指定している場合の対応

固定のipv4のipアドレスを直接アプリでリテラル指定している場合は修正が必要になります。
webviewやwebapi時に指定しているホストはipアドレスではなくドメイン指定としてください。

Don’t Use IP Address Literals
Make sure you aren’t passing IPv4 address literals in dot notation to APIs such as getaddrinfo and SCNetworkReachabilityCreateWithName. Instead, use high-level network frameworks and address-agnostic versions of APIs, such as getaddrinfo and getnameinfo, and pass them hostnames or fully qualified domain names (FQDNs). See getaddrinfo(3) Mac OS X Developer Tools Manual Page and getnameinfo(3) Mac OS X Developer Tools Manual Page.

引用:
https://developer.apple.com/library/

非推奨なネットワークapiを使用している場合の対応

ipv4に依存(ipv4で動作しているメソッドなど)したメソッドをコールしている場合は修正が必要になります。

ipv4に依存したNSURLConnectionを使っている場合は、代わりにNSURLSessionを使ってください。

Deprecated APIs

The following APIs are deprecated:

The Address Book and Address Book UI frameworks. Use the Contacts and Contacts UI frameworks instead.
The NSURLConnection API in the Foundation framework. Use NSURLSession APIs instead.

引用:
https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html

ipv4依存のapiを仕様している場合の対応

変数指定で「uint32_t, in_addr, sockaddr_in」を使っている場合、apiで「inet_aton, gethostbyname」を使っている場合、ipv4でしか動作しないapiをコールしている場合、ipv4のアドレスチェックをアプリでしている場合などはipv6で動作するよう修正が必要とあります。

What Breaks?
IPv4-only code
IPv4-only storage objects: uint32_t, in_addr, sockaddr_in
IPv4-only APIs: inet_aton, gethostbyname
IPv4-only usage of an API: gethostbyname2(hostname, AF_INET);
Pre-flight checks before connecting
• Checking if device has an IPv4 address
• Checking for reachability to 0.0.0.0

引用:
http://devstreaming.apple.com/videos/wwdc/2015/719ui2k57m/719/719_your_app_and_next_generation_networks.pdf

対応期限

At WWDC 2015 we announced that iOS 9 will support IPv6-only network services. All apps submitted to the App Store must support IPv6 starting in early 2016. To make sure your app is compatible, use the networking frameworks (e.g., “NSURLSession”), avoid use of IPv4-specific APIs, and avoid hard-coded IP addresses. Before submitting your app, test for compatibility.

引用:
https://developer.apple.com/news/?id=08282015a

「starting in early 2016」とある通り
今のところは2016年初頭までに対応する必要があるようです。元々の発表では2015年末までだったため、変更が入りました。
ここを過ぎるとAppleStoreの審査に通らなくなります。これから実装するものは対応を必須としたほうがよさそうです。

APNSプッシュ通知について

iOS9対応とは別でAPNSの仕様が変更されます。
2016年で正確な日付はアナウンスされていませんが、デバイストークンの長さが32バイトから100バイトに変更されます。
DBのサイズが100未満で固定にしている場合は変更が必要ですね。

APNS token getting bigger
Up until this point, a device token (used to identify a particular iOS or Mac device for the purposes of sending push notifications) has been a 32-character hexadecimal string. At WWDC 2015 – buried in the middle of a history lesson about how to use APNS – Apple quietly announced that they are planning on lengthening their device tokens from 32 bytes to 100 bytes next year. It may seem like a boring change – but it’s something many of us will need to plan for by checking that our database schema will accommodate these larger tokens.

引用:
http://odecee.com.au/wwdc-2015-big-changes-to-apple-push-notifications/

他サービスのios9のアナウンスについて

うーん、動作検証した上で動かない可能性を懸念するのはなにがあるんでしょう。

『アイ★チュウ』 iOS9対応につきまして
http://www.i-chu.jp/p655

【重要】スマレジのiOS9対応について
http://timecard.smaregi.jp/news/press/2015090847.php

感想

Androidと違いiosはバージョンが上がったタイミングでSDKにあわせて移行対応が必要になる場合が多いので毎年この時期は大変です。
Androidも必須でなくてもバージョンが上がったらガイドラインの変更にあわせて直した(Deprecateメソッドも増えるので)ほうがいいですね。
ただ便利なUIツールやAPIが使えないっていうくらいな印象です。

その他おすすめの備忘録

Tagged with:
 

コメントを残す