Быстрый старт с iOS SDK
Начните работу с Pushwoosh iOS SDK на этом простом и быстром примере.
Предварительные требования
Anchor link toДля интеграции Pushwoosh iOS SDK в ваше приложение вам понадобится следующее:
Скачайте пример проекта
Anchor link toСклонируйте пример проекта с GitHub:
git clone https://github.com/Pushwoosh/pushwoosh-ios-sample.git
Настройте проект
Anchor link toOpen the project in Xcode.
Add
https://github.com/Pushwoosh/Pushwoosh-XCFramework
as Swift Package Dependency.Set the bundle identifier for the main target (PushwooshSampleApp) to match your Pushwoosh project (e.g.,
com.pushwoosh.PushwooshSampleApp
).Use the same bundle identifier for the NotificationService target, appending
.NotificationService
(e.g.,com.pushwoosh.PushwooshSampleApp.NotificationService
).In
Info.plist
, set the:Pushwoosh_APPID
key to the Pushwoosh Application CodePushwoosh_API_TOKEN
key to the Pushwoosh Device API Token
Important: Be sure to give the token access to the right app in your Pushwoosh Control Panel. Learn more
Запустите проект
Anchor link to- Соберите и запустите проект.
- В приложении будет две вкладки: «Actions» и «Settings». Перейдите на вкладку Settings.
- Нажмите кнопку Register for Pushes.
- Предоставьте разрешение на получение push-уведомлений. Устройство будет зарегистрировано в Pushwoosh.
Вы должны увидеть в логах запись, подобную этой:
Pushwoosh: Initializing application runtime[PW] BUNDLE ID: __YOUR_BUNDLE_ID__[PW] APP CODE: __YOUR_APP_CODE__[PW] PUSHWOOSH SDK VERSION: 6.7.13[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.
Отправьте push-уведомление
Anchor link toВернитесь в Pushwoosh Control Panel и отправьте push-уведомление на ваше зарегистрированное устройство.
Что дальше
Anchor link toЧтобы узнать больше, обратитесь к руководству по базовой интеграции