App Clips

作者 dpearson26998d90fd121a26无许可证1.1K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库2个月前更新

Build iOS App Clips with invocation URLs, App Clip Codes, NFC, QR codes, Safari banners, Maps, Messages, target setup, App Store Connect experiences, size/capability constraints, NSUserActivity routing, SKOverlay promotion, App Group/keychain handoff, ephemeral notifications, location confirmation, and full-app migration. Use when creating App Clips or wiring App Clip invocation, experience configuration, or full-app handoff.

AI 生成的概览

指导构建 iOS App Clip:目标配置、调用路由、体积限制、数据交接与推广。

功能
该技能提供在 Xcode 中创建 iOS App Clip 的说明,涵盖目标与授权配置、通过 NSUserActivity 的调用 URL 路由、App Store Connect 体验、App Clip 码、NFC、二维码和 Safari 横幅。它还涉及体积与能力限制、App Group 与钥匙串向完整应用的交接、临时通知、位置确认以及 SKOverlay 推广。其产出为指引、检查清单和验证检查点,而非代码产物,并指向三份随附参考文档。
适用场景
在创建 App Clip,或配置 App Clip 调用、体验配置、与完整应用交接时使用。也适用于对 App Clip 体积、能力和推广决策进行可行性评估。
运行要求
不含脚本,仅为说明与参考文档。实际构建所述 App Clip 需要 Xcode、具备 App Store Connect 访问权限的 Apple 开发者账号、关联域名与 AASA 托管,以及 App Clip 框架。

App Clips

Build lightweight, instantly available versions of an iOS app for focused in-the-moment experiences or demos.

Contents

App Clip Target Setup

An App Clip is a separate target in the same Xcode project as your full app:

  1. File → New → Target → App Clip — Xcode creates the App Clip target, adds the Embed App Clip build phase to the full app target, and wires the association entitlements.
  2. The App Clip bundle ID must be prefixed by the full app's bundle ID: com.example.MyApp.Clip.
  3. Verify raw entitlement keys when diagnosing archive, signing, or App Store Connect failures:
    • App Clip target: com.apple.developer.on-demand-install-capable
    • App Clip target parent app link: com.apple.developer.parent-application-identifiers
    • Full app target associated App Clip link: com.apple.developer.associated-appclip-app-identifiers

Use Swift packages or shared source files for code needed by both targets. Add App Clip-specific compile branches with the APPCLIP active compilation condition, and avoid linking full-app-only frameworks into the App Clip target.

Validation checkpoint: Archive both targets and inspect their archived entitlements. If signing or validation fails, correct the three raw key/target assignments above and rearchive until both pass.

Invocation and Experience Routing

Read references/routing-and-experiences.md [blocked] when implementing invocation URL routing, App Store Connect experiences, Local Experiences, Safari Smart App Banners, QR/NFC/App Clip Codes, AASA, or associated domains.

App Clips receive NSUserActivityTypeBrowsingWeb activities. Keep the invocation router shared with the full app because, after installation, the full app replaces the App Clip and receives future invocations.

  • SwiftUI: use .onContinueUserActivity(NSUserActivityTypeBrowsingWeb).
  • UIKit cold launch: inspect connectionOptions.userActivities in scene(_:willConnectTo:options:).
  • UIKit continuation: handle the actual NSUserActivity in scene(_:continue:).
  • scene(_:willContinueUserActivityWithType:) is only advance notice and does not provide the URL.

Configure the required default App Clip experience in App Store Connect. Use advanced experiences for Maps integration, location association, production App Clip Codes, per-location cards, and precise physical-place routing; demo App Clip Codes can use the short demo App Clip link.

For custom URLs, add appclips:example.com to Associated Domains on both the full app and App Clip targets, and host an AASA file with the App Clip app identifier. For Safari banners, use app-id, app-clip-bundle-id, and optional app-clip-display=card; do not rely on app-argument for App Clip launches.

Validation checkpoint: Exercise each URL with _XCAppClipURL and a Local Experience, fix routing/AASA/experience mismatches, and repeat until the App Clip and installed full app reach the same destination.

Size and Capability Decisions

Use Size, capabilities, and promotion [blocked] as the authoritative checklist for feasibility reviews, size tiers and measurement, Background Assets, CloudKit, Live Activities, unsupported features, and full-app promotion. Load it whenever any of those topics is in scope.

Keep product reviews at the boundary level: state the size basis, invocation and download fit, capability exclusions, and handoff destination. Add implementation APIs only when the user asks for implementation.

Data, Notifications, and Location

Read references/data-handoff-notifications-location.md [blocked] when implementing App Group/full-app migration, keychain or Sign in with Apple handoff, ephemeral notifications, notification relaunch routing, or physical location confirmation.

Treat App Group storage as non-secret handoff state, not a trust boundary. The reference owns the iOS 15.4+ one-way keychain rule, Sign in with Apple verification, ephemeral-notification permission and relaunch routing, and physical-location confirmation—including their required raw keys and targets.

Common Mistakes

Exceeding the applicable App Clip size limit

Choose and measure the applicable limit using Size Limits [blocked].

Designing a marketing-only or web-view-heavy App Clip

App Clips should let people complete a focused task or full demo without installing the app. Avoid marketing-only clips, ad-heavy flows, splash screens, launch-blocking downloads, repeated install prompts, and web-view-heavy experiences that would work better as a website.

Review Checklist

Do not ship until every applicable gate passes; fix failures and rerun the same gate.

  • Target IDs, all three raw entitlement keys, and shared-code boundaries are correct.
  • Invocation works for SwiftUI/UIKit cold launch and continuation, then hands off to the full app.
  • Associated domains, AASA, App Store Connect experiences, and local invocation tests pass.
  • Size, capability, UX, Live Activity, and promotion decisions pass the feasibility review [blocked].
  • Data, credential, notification, and location flows pass the detailed handoff checks [blocked].

References

来源与署名

来源:dpearson2699/swift-ios-skills位于skills/app-clips提交8d90fd1

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架

更多来自 dpearson2699/swift-ios-skills 的技能

Widgetkit

dpearson2699

指导实现、审查和改进 iOS、iPadOS、watchOS 与 CarPlay 上的 WidgetKit 小组件和控制项。

Software Development1.1K2个月前更新

Weatherkit

dpearson2699

指导 iOS 开发者使用 WeatherService 获取 WeatherKit 预报、警报与署名信息。

Software Development1.1K2个月前更新

Vision Framework

dpearson2699

Implement computer vision features including text recognition (OCR), face detection, barcode scanning, image segmentation, object tracking, and document scanning in iOS apps. Covers both the modern Swift-native Vision API (iOS 18+) and legacy VNRequest patterns, VisionKit DataScannerViewController for live camera scanning, and CoreMLRequest/VNCoreMLRequest for custom model inference. Use when adding OCR, barcode scanning, face detection, or custom Core ML model inference with Vision.

待分类1.1K2个月前更新

Tipkit

dpearson2699

Implement and review Apple TipKit feature-discovery UI for iOS 17+ apps. Use when adding or auditing in-app tips, contextual help, coach marks, Tip, TipView, popoverTip, rules, events, actions, display frequency, testing overrides, reusable tip identifiers, or iOS 18+ TipGroup and CloudKit tip sync; avoid for generic SwiftUI navigation or layout outside tip presentation.

待分类1.1K2个月前更新

Tabletopkit

dpearson2699

指导使用 TabletopKit 在 visionOS 上构建多人空间桌游,涵盖棋具、座位、动作与 RealityKit 渲染。

Software Development1.1K2个月前更新

Swiftui Webkit

dpearson2699

指导在 iOS 26 及更高版本的 SwiftUI 应用中使用 WebKit for SwiftUI 嵌入和控制网页内容。

Software Development1.1K2个月前更新