# iOS SDK 7.0+ 快速入门

通过这个快速简单的示例开始使用 Pushwoosh iOS SDK。

## iOS SDK 7.0+ 的新功能

从 7.0 版本开始，Pushwoosh iOS SDK 采用了全新的模块化架构进行了重新设计。该 SDK 现在被拆分为独立的模块：**PushwooshFramework**、**PushwooshCore**、**PushwooshBridge** 和 **PushwooshLiveActivities** 是基本集成所必需的，而 **PushwooshForegroundPush**、**PushwooshVoIP** 和 **PushwooshTVOS** 则可以根据您的需求选择性添加。

这种模块化方法允许您只包含应用程序实际使用的功能，从而减小最终二进制文件的大小并缩短构建时间。每个模块都可以独立更新，这使得在不影响其余集成的情况下采用新功能变得更加容易。

此版本引入了对原生 Swift Package Manager 的支持，以便更轻松地进行依赖管理，同时改进了所有模块之间的 Swift 互操作性。文档现在直接嵌入到二进制框架中，因此您可以通过 Xcode 中的“快速帮助”和“开发者文档”窗口直接访问 API 参考和代码示例。新功能包括全面支持 iOS 16+ 的 Live Activities（实时活动）与 Dynamic Island（灵动岛）集成、可自定义的前台推送通知（带有动画横幅和触觉反馈）、增强的 VoIP 功能以及专为 Apple TV 应用程序设计的 tvOS 模块。

## 先决条件

要将 Pushwoosh iOS SDK 集成到您的应用程序中，您需要满足以下条件：

<TranslatedFragment id="prerequisites-ios" />

## 下载示例项目

从 GitHub 克隆示例项目：
```bash
git clone https://github.com/Pushwoosh/pushwoosh-ios-sample.git
```

## 配置项目

<TranslatedFragment id="configure-sample-app-ios" />

## 运行项目

1. 构建并运行项目。
2. 该应用程序将有两个选项卡：“Actions”和“Settings”。导航到 **Settings** 选项卡。
3. 点击 **Register for Pushes** 按钮。
4. 授予推送通知权限。设备将在 Pushwoosh 注册。

您应该会看到类似这样的日志条目：
```bash
Pushwoosh: Initializing application runtime
[PW] BUNDLE ID: __YOUR_BUNDLE_ID__
[PW] APP CODE: __YOUR_APP_CODE__
[PW] PUSHWOOSH SDK VERSION: 7.0.0
[PW] HWID: __YOUR_HWID__
[PW] PUSH TOKEN: (null)
[PW] [I] -[PWNotificationManagerCompatiOS10] NotificationCenter authorization granted: 1
[PW] [I] -[PWPushNotificationsManagerCommon] Registered for push notifications: __YOUR_PUSH_TOKEN__
```
您的设备现已在 Pushwoosh 注册。

## 发送推送通知

返回 Pushwoosh 控制面板，并向您注册的设备[发送一条推送通知](/zh/product/messaging-channels/push-notifications/send-push-notifications/one-time-push)。

## 从 SDK 6.x 迁移

如果您从 SDK 6.x 版本升级，主要变化在于访问 Pushwoosh 实例的方式。在 7.0+ 版本中，请使用 `Pushwoosh.configure` 而不是 `Pushwoosh.sharedInstance()`：

**之前 (6.x)：**
```swift
Pushwoosh.sharedInstance().registerForPushNotifications()
Pushwoosh.sharedInstance().delegate = self
```

**之后 (7.0+)：**
```swift
Pushwoosh.configure.registerForPushNotifications()
Pushwoosh.configure.delegate = self
```

所有其他 API 保持不变，因此更新您的代码只需在整个项目中将 `sharedInstance()` 替换为 `configure` 即可。

## 后续步骤
要了解更多信息，请参阅[基本集成指南](/zh/developer/pushwoosh-sdk/ios-sdk/setting-up-pushwoosh-ios-sdk-7-0/basic-integration-guide/)。