AppSwitcher
でアプリをユーザーファーストに

Ryosuke Hiramatsu
自己紹介
・@himara2
・東京ミッドタウンでエンジニア
・会社や個人でiOSアプリを作ってます

・今日はAppSwitcherについて話します
Manifesto
AppSwitcher?
・iOS 7から登場
・ホームボタンダブルタップで出るアレ
・アイコン+スクリーンショット
・「UIが良ければユーザーは戻る」
変わったのは見た目だけ、

ではない
スワイプして消すと...
・「バックグラウンド実行」がSTOP!
・Background Fetch
・Silent Push Notification
・Location Services
スワイプして消すと...
・「バックグラウンド実行」がSTOP!
・Background Fetch
・Silent Push Notification
・Location Services

色々な問題が発生する
○その1
バックグラウンドで
生き続ける必要があるアプリ
○その1 - バックグラウンドで生き続ける必要があるアプリ

アプリが終了された
タイミングでAlertを出す。
○その1 - バックグラウンドで生き続ける必要があるアプリ

<アプリが終了したタイミングでLocal通知>
- (void)applicationWillTerminate:(UIApplication *)application
{
UILocalNotification *notification = [[UILocalNotification alloc] init];
if (notification)
{
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.repeatInterval = 0;
notification.alertBody = @"アプリを終了するとログがとれなくなります。再起動しますか?";
notification.alertAction = @"再起動する";

}

}

[[UIApplication sharedApplication] scheduleLocalNotification:notification];

※willTerminateが呼ばれるには
バックグラウンド実行中である必要があります。
○その2
途中で切られたら
タスクが完了できないアプリ。
○その2 - 途中で切られたタスクが完了できないアプリ
○その2 - 途中で切られたタスクが完了できないアプリ
- (UIView *)coverView {
if (_coverView == nil) {
UIStoryboard *board = self.window.rootViewController.storyboard;
UIViewController *vc = [board
instantiateViewControllerWithIdentifier:@"CoverViewController"];
_coverView = vc.view;
}
return _coverView;
}
- (void)setCoverPage {
[self.window addSubview:self.coverView];
}
- (void)removeCoverPage {
[self.coverView removeFromSuperview];
}

- (void)applicationWillResignActive:(UIApplication *)application
{
[self setCoverPage];
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[self removeCoverPage];
}
○番外編
AppSwitcher画面を
装飾する時に気をつけること
装飾する際の注意
・カードのサイズは以下
Device
| Card size
| Device screen size
---------------|-----------------------------------3.5" iPhone(r) | 304 x 456
|
640 x 960
4.0" iPhone(r) | 304 x 540
|
640 x 1136
iPad
| 384 x 512
|
1024 x 768
iPad (retina) | 768 x 1024 |
2048 x 1536

・テキストはかなり大きめにする
・BackgroundFetchで随時変更も可
- ScreenShotの方向は
EnterBackground 時のもので固定
参考
バックグラウンドで動くアプリが終了された
タイミングでアラートを出す - koogawa blog

アプリの画面を開いているアプリケーションの
プレビュー画面から隠す - qiita.com

A closer look at the iOS7 App Switcher
- VINH PHUC DINH

サンプルコード - GitHub
終わり

AppSwitcherでアプリをユーザーファーストに