swift86 [iOS] CFGetRetainCount Apple Developer Documentation developer.apple.com CFGetRetainCount Core Foundation Object의 reference count를 반환한다. memory leak이 있는 부분을 디버깅할 때 사용하면 유용하다. 예제 class Test { deinit { print("deinit \(CFGetRetainCount(self))") } var closure: (() -> Void)? = { } func doing() { defer { print("doing defer \(CFGetRetainCount(self))") } print("doing start \(CFGetRetainCount(self))") closure = { self } } } va.. 2022. 6. 2. [iOS] Xcode에서 Application state 확인하기 Xcode에서 Application state 확인하기 앱 실행 Xcode Inspector에서 Debug navigator 탭 클릭 energy Impact 클릭 Application State에서 실시간으로 앱의 상태 변화 확인 가능 Foreground Background Suspended 2022. 5. 30. [iOS] Local Notification은 suspended에서 동작할까 문득 Local Notification을 앱이 suspended 상태로 전환되기 직전에 center에 request들을 추가해서 scheduling 해놓으면 동작할까라는 의문이 생겼다. 원래 Push Notification은 앱의 상태와 상관없이 동작해야하는게 맞기 때문에 동작은 당연히 할거라고 생각했는데 suspended 상태에서 동작하는지 background상태에서 동작하는지 명확히 확인하고 싶어서 테스트를 해보았고 결론은 'suspended에서 동작한다' 였다. func applicationDidEnterBackground(_ application: UIApplication) { var time: TimeInterval = 0 for _ in 0 ..< 10 { let content = UNMuta.. 2022. 5. 30. [iOS] applicationWillTerminate When will applicationWillTerminate be called? In what situations will applicationWillTerminate be called? For example, will it ocassionally be called if there is a crash in the code? Apple's doc is vague on this, it only says when the system ... stackoverflow.com applicationWillTerminate applicationWillTerminate는 app이 terminate되기 직전에 호출된다. 항상 background 상태에서만 호출이 되며 suspended 상태에선 system이 app을 종.. 2022. 5. 25. 이전 1 2 3 4 5 6 7 ··· 22 다음