LoginSignup
0
0

ID by amoのアプリを閉じる挙動を再現

Posted at

ID by amoにて新着通知を全て確認し終わると、「おわり!」「そっちでも楽しんでね」などのメッセージと共にアプリが終了する

これをSwiftでやるには任意の場所で以下を実行する

UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
Timer.scheduledTimer(withTimeInterval: 0.2, repeats: false) { _ in
  exit(0)
}

ホーム画面に戻る

UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)

exit(0)はCの標準ライブラリに存在する関数
 プログラムを正常終了させるもの

引用元

アプリ起動中に、コードによりホーム画面に戻る方法 #Swift - Qiita

Scrapbox版

ID by amoのアプリを閉じる挙動を再現

ChatGPTに質問してみた

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0