3
0

More than 1 year has passed since last update.

iOSでカメラの権限を変えた後アプリに戻ると強制再起動することについて

Last updated at Posted at 2023-08-25

先日Flutterでアプリを開発していてカメラの権限周りを触ることがあったのですが、アプリが動いている状態で設定に移動し権限を変更してからアプリに戻ると以下のようなログを吐いてアプリが落ちてしまうという現象に遭いました。

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGKILL
    frame #0: 0x0000000000000004 libsystem_kernel.dylib`mach_msg_trap + 8
libsystem_kernel.dylib`mach_msg_trap:
->  0x000000004 <+8>: ret    
libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x000000008 <+0>: mov    x16, #-0x20
    0x00000000c <+4>: svc    #0x80
    0x000000010 <+8>: ret    
Target 0: (Runner) stopped.

最初はバグかと思い直そうとしていたのですがどうやっても改善できず、色々と調査していたら以下のようなFlutterへのissueを見つけました。
[Camera] Application crashes if permission changed while app is running · Issue #126429 · flutter/flutter
どうやらiOSの仕様上カメラの権限を変えた後アプリに戻るとOSによって強制的に再起動させられてしまうらしく、バグではなかったようです。
この調査で結構時間を使ってしまったので備忘録的に残しておきます。

3
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
3
0