IOS
iOS
iOS 18 アクションボタン https://support.apple.com/ja-jp/guide/iphone/iphe89d61d66/ios https://support.apple.com/ja-jp/guide/iphone/iphe89d61d66/18.0/ios/18.0 デペロッパーモード Enabling Developer Mode on a device | Apple Developer Documentation WatchDog サンプルコード AppDelegate.swiftを追加する。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // AppDelegate.swift import UIKit import os class MyAppDelegate: NSObject { private let logger = Logger(subsystem: "com.hiroakit.AppPlayground1", category: "Launch") func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { logger.log("Start didFinishLaunchingWithOptions") sleep(25) logger.log("End didFinishLaunchingWithOptions") return true } } クラッシュレポート 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Incident Identifier: 556FE78A-C58C-422B-815B-4C2D77779A0A CrashReporter Key: 6d90d78f5c7dd0d6c190d36604deee3ba4b1bc3a Hardware Model: iPhone17,3 Process: AppPlayground1 [4612] Path: /private/var/containers/Bundle/Application/F592CC68-C4ED-4822-8B5D-71EF7ABAEAE4/AppPlayground1.app/AppPlayground1 Identifier: com.hiroakit.AppPlayground1 Version: 1.0 (1) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.hiroakit.AppPlayground1 [2421] Date/Time: 2025-03-02 10:28:29.0745 +0900 Launch Time: 2025-03-02 10:28:08.0605 +0900 OS Version: iPhone OS 18.3.1 (22D72) Release Type: User Baseband Version: 1.40.03 Report Version: 104 Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: FRONTBOARD 2343432205 <RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-create watchdog transgression: app<com.hiroakit.AppPlayground1(E45319F4-4216-43EF-A72C-A899B7230DFB)>:4612 exhausted real (wall clock) time allowance of 19.97 seconds ProcessVisibility: Foreground ProcessState: Running WatchdogEvent: scene-create WatchdogVisibility: Foreground WatchdogCPUStatistics: ( "Elapsed total CPU time (seconds): 22.100 (user 11.320, system 10.780), 18% CPU", "Elapsed application CPU time (seconds): 0.009, 0% CPU" ) reportType:CrashLog maxTerminationResistance:Interactive> Triggered by Thread: 0 資料 Addressing watchdog terminations https://developer.apple.com/documentation/xcode/addressing-watchdog-terminations ロギング swift-log https://github.com/apple/swift-log https://apple.github.io/swift-log/docs/current/Logging/Structs/Logger.html インストール Xcode File > Add Package Dependencies… Package.swift https://github.com/apple/swift-log?tab=readme-ov-file#adding-the-dependency ロギングAPIのLoggerとos_log ロギングAPIの歴史 2005年、AppleはMac OS X 10.4 TigerでApple System Logger (ASL) を導入した。同年のWWDC 2005 Session 510 Core OS Enhancements for BSD DevelopersではApple System Loggerに触れているらしいが資料が見当たらない。
Watchdogタイマー
はじめに iOSアプリの起動(アプリプロセスを起こすこと)に時間がかかる場合、iOSはそのアプリにEXC_CRASH (SIGKILL)を送り、アプリを強制終了する。
ネットワーク速度の変更
iOS 18 速度変更の方法 設定アプリを起動する デペロッパ をタップ ネットワークリンク調節器 をタップ 以前の名称は Network Link Conditioner だった 有効にする をオンにする 下部で選択したプロファイルが有効となる 使い終わったら、 有効にする をオフにする 計測 fast.comで下りの回線速度を計測した。
位置情報サービス
概要 アプリはiOSの位置情報サービスから緯度、経度を取得できる。 ユーザーによる認可 アプリがiOSの位置情報サービスにアクセスするには、Authorization(ユーザーによる認可)が必要である。
ロギング
swift-log https://github.com/apple/swift-log https://apple.github.io/swift-log/docs/current/Logging/Structs/Logger.html インストール Xcode File > Add Package Dependencies… Package.swift https://github.com/apple/swift-log?tab=readme-ov-file#adding-the-dependency ロギングAPIのLoggerとos_log ロギングAPIの歴史 2005年、AppleはMac OS X 10.4 TigerでApple System Logger (ASL) を導入した。同年のWWDC 2005 Session 510 Core OS Enhancements for BSD DevelopersではApple System Loggerに触れているらしいが資料が見当たらない。
ロギングAPIのLoggerとos_log
ロギングAPIの歴史 2005年、AppleはMac OS X 10.4 TigerでApple System Logger (ASL) を導入した。同年のWWDC 2005 Session 510 Core OS Enhancements for BSD DevelopersではApple System Loggerに触れているらしいが資料が見当たらない。