← 返回
开发者工具 中文

iOS

Build, test, and ship iOS apps with Swift, Xcode, and App Store best practices.
使用 Swift、Xcode 及 App Store 最佳实践,构建、测试并发布 iOS 应用。
ivangdavila ivangdavila 来源
开发者工具 clawhub v1.0.0 1 版本 99966.1 Key: 无需
★ 6
Stars
📥 2,833
下载
💾 97
安装
1
版本
#latest

概述

iOS Development Rules

Xcode & Build

  • Clean build folder (Cmd+Shift+K) fixes most "impossible" build errors — derived data gets corrupted regularly
  • Simulator reset (Device > Erase All Content and Settings) clears cached app state that survives reinstalls
  • Archive builds use Release config — bugs that only appear in production often stem from optimization differences
  • xcodebuild -showsdks lists available SDKs — useful when builds fail with "SDK not found"
  • Parallel builds can cause race conditions in script phases — add input/output file lists to enforce ordering

Code Signing

  • "No signing certificate" usually means certificate is expired or revoked — check in Keychain Access, not just Xcode
  • Provisioning profiles embed device UDIDs — new test device requires profile regeneration and reinstall
  • Automatic signing fails in CI — always use manual signing with exported credentials for builds
  • Distribution certificates are limited to 3 per account — don't create new ones, export and share the existing one
  • After renewing a certificate, update ALL provisioning profiles that used the old one

SwiftUI Patterns

  • @State for view-local data, @StateObject for owned ObservableObjects, @ObservedObject for passed-in objects — mixing them wrong causes crashes or lost state
  • List with id: \.self on non-Hashable types causes silent failures — always use explicit id parameter with stable identifiers
  • task modifier cancels automatically on view disappear — no manual cancellation needed, but check Task.isCancelled in loops
  • Previews crash silently with real network calls — use mock data or dependency injection for previews
  • @Environment values are nil in previews unless explicitly provided — wrap previews in container with environment set

App Store Rules

  • Apps must work offline or show clear offline state — silent failures cause rejection
  • Login must be skippable if app has non-account features — reviewers reject mandatory login for content browsing
  • "Sign in with Apple" is required if you offer any third-party social login — no exceptions
  • Privacy labels must match actual data collection — Apple verifies and rejects mismatches
  • In-app purchases must use StoreKit for digital goods — external payment links get rejected

Info.plist Requirements

  • ITSAppUsesNonExemptEncryption = NO avoids export compliance questions for most apps — add it to skip the daily annoyance
  • Camera/microphone/location usage descriptions are mandatory — missing them crashes the app on access attempt
  • LSApplicationQueriesSchemes must list URL schemes before canOpenURL works — iOS 9+ security requirement
  • UIRequiresFullScreen = YES on iPad opts out of multitasking — use only if your app truly can't support split view

Performance

  • Instruments > Time Profiler reveals actual bottlenecks — don't guess, measure
  • Images in Assets.xcassets get optimized automatically — loose files in bundle don't
  • @MainActor annotation ensures UI updates happen on main thread — missing it causes random crashes under load
  • Memory leaks often hide in closures — use [weak self] in escaping closures that reference self
  • List with thousands of items is fast, ForEach in ScrollView is not — List uses cell reuse, ScrollView loads everything

Debugging

  • po in LLDB prints object description, p prints raw value — use po for most debugging
  • Purple warnings in Console indicate main thread violations — fix these, they cause jank
  • -com.apple.CoreData.SQLDebug 1 in launch arguments shows all Core Data queries — essential for debugging fetch performance
  • Crash logs without symbols are useless — keep dSYM files for every release build
  • TestFlight crashes appear in Xcode Organizer — check there, not just in App Store Connect

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 18:23 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 325,698
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,383 📥 320,794
office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 449 📥 150,088