docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,130 @@
---
id: ios-push-notifications
title: iOS Push Notifications — APNs / 권한 / 백그라운드
category: Coding
status: draft
source_trust_level: B
verification_status: conceptual
created_at: 2026-05-09
updated_at: 2026-05-09
tags: [ios, push, apns, notifications, vibe-coding]
tech_stack: { language: "Swift / APNs", applicable_to: ["iOS"] }
applied_in: []
aliases: [APNs, device token, silent push, rich notification]
---
# iOS Push Notifications
> Apple Push Notification service (APNs) 통한 push. **(1) 권한 요청, (2) device token 받기 → 서버 등록, (3) APNs payload, (4) 받은 후 처리** 4단계. silent push 와 alert push 다름.
## 📖 핵심 개념
- Alert push: UI 표시 (사용자 권한 필요).
- Silent push: 백그라운드 데이터 sync — UI 없음, 권한 X. `content-available: 1`.
- 사용자 행동 (탭, action) 처리 별도.
## 💻 코드 패턴
### 권한 요청
```swift
import UserNotifications
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound, .provisional]) { granted, error in
if granted {
DispatchQueue.main.async { UIApplication.shared.registerForRemoteNotifications() }
}
}
```
`provisional`: 사용자 명시 동의 없이 silently 등록 → 알림이 처음엔 조용히 노티 센터에만. 좋은 UX.
### Device token 받기 (AppDelegate)
```swift
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
Task { try? await api.registerPushToken(token) }
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("APNs reg failed: \(error)")
}
```
### Foreground / background 표시
```swift
// AppDelegate / scene
UNUserNotificationCenter.current().delegate = self
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.banner, .badge, .sound]) // foreground banner
}
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
if let url = userInfo["deeplink"] as? String { open(url) }
completionHandler()
}
```
### Silent push 처리 (background fetch)
```swift
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult {
do {
try await syncManager.pull()
return .newData
} catch {
return .failed
}
}
```
`Info.plist` → Background Modes → Remote notifications enable.
### APNs payload 예시
```json
{
"aps": {
"alert": { "title": "새 메시지", "body": "Alice: 안녕" },
"badge": 3,
"sound": "default",
"thread-id": "chat-1",
"category": "MESSAGE"
},
"deeplink": "myapp://chat/1"
}
```
Silent:
```json
{ "aps": { "content-available": 1 }, "syncToken": "abc" }
```
## 🤔 의사결정 기준
| 알림 종류 | 사용 |
|---|---|
| 사용자 메시지 (chat, mention) | Alert (소리 + 진동) |
| 백그라운드 sync (이메일, 캘린더) | Silent (content-available) |
| 부드러운 안내 (cron 마케팅) | Provisional (조용한 노티) |
| 시간 민감 (alarm, 결제 인증) | Time-Sensitive interrupt level |
| 위치 변화 / 트리거 | Location notification |
## ❌ 안티패턴
- **권한 요청을 앱 첫 실행에 즉시**: 거부율 높음. 가치 보여준 후 적절 시점.
- **device token 한 번만 등록**: token 은 변경 가능 (앱 재설치, OS 업그레이드). 매 launch 등록 + 서버 dedup.
- **token 을 분석/로그에 남김**: PII 비슷. redact.
- **silent push 폭주**: APNs 가 throttle. 10/hour 정도가 안전.
- **백그라운드 fetch 가 너무 무거움**: 30초 한도. 가벼운 작업만, 큰 sync 는 BGTask.
- **iOS Foreground 에서 알림 안 보여줌 가정**: willPresent 안 구현하면 그냥 사라짐.
- **notification action 안 처리**: 사용자 답장 / 액션 버튼 무반응.
## 🤖 LLM 활용 힌트
- 권한 = provisional 우선, 명시 권한은 가치 노출 후.
- Silent 는 조심 (throttle).
## 🔗 관련 문서
- [[iOS_Background_Tasks]]
- [[Backend_Job_Queue_Patterns]]