LoginSignup
1
1

More than 3 years have passed since last update.

[Swift] NSLogを安易に使ってしまうとセキュリティ的にマズい

Last updated at Posted at 2020-09-20

前提環境

  • Xcode 11.3.1
  • Swift 5.1.3

ログ出力とセキュリティ

printと比べてNSLogは日時を出力してくれるので便利そうに見えますが、、、
スクリーンショット 2020-09-15 9.06.22.png

端末をPC接続して、Apple Configurator 2などのツールを使うとコンソールに出力されてしまいます。
セキュリティ的に危うい状況です。
スクリーンショット 2020-09-15 9.08.38.png

一方、printはコンソールに出力されません。

printを自前で拡張するか、SwiftLog(Apple製のOSSライブラリ)などを利用すると良いかと思います。
https://github.com/apple/swift-log

1
1
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
1
1