ข้ามไปยังเนื้อหา

เริ่มต้นใช้งาน iOS SDK ฉบับรวบรัด

เริ่มต้นใช้งาน Pushwoosh iOS SDK ด้วยตัวอย่างที่รวดเร็วและง่ายดายนี้

ข้อกำหนดเบื้องต้น

Anchor link to

ในการผสานรวม Pushwoosh iOS SDK เข้ากับแอปของคุณ คุณจะต้องมีสิ่งต่อไปนี้:

ดาวน์โหลดโปรเจกต์ตัวอย่าง

Anchor link to

โคลนโปรเจกต์ตัวอย่างจาก GitHub:

Terminal window
git clone https://github.com/Pushwoosh/pushwoosh-ios-sample.git

กำหนดค่าโปรเจกต์

Anchor link to
  1. Open the project in Xcode.

  2. Add https://github.com/Pushwoosh/Pushwoosh-XCFramework as Swift Package Dependency.

  3. Set the bundle identifier for the main target (PushwooshSampleApp) to match your Pushwoosh project (e.g., com.pushwoosh.PushwooshSampleApp).

  4. Use the same bundle identifier for the NotificationService target, appending .NotificationService (e.g., com.pushwoosh.PushwooshSampleApp.NotificationService).

  5. In Info.plist, set the:

Important: Be sure to give the token access to the right app in your Pushwoosh Control Panel. Learn more

รันโปรเจกต์

Anchor link to
  1. บิวด์และรันโปรเจกต์
  2. แอปจะมีสองแท็บ: “Actions” และ “Settings” ไปที่แท็บ Settings
  3. แตะปุ่ม Register for Pushes
  4. ให้สิทธิ์สำหรับการแจ้งเตือนแบบพุช อุปกรณ์จะถูกลงทะเบียนกับ Pushwoosh

คุณควรจะเห็นรายการบันทึก (log) ลักษณะนี้:

Terminal window
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 เรียบร้อยแล้ว

ส่งการแจ้งเตือนแบบพุช

Anchor link to

กลับไปที่ Pushwoosh Control Panel และ ส่งการแจ้งเตือนแบบพุช ไปยังอุปกรณ์ที่ลงทะเบียนไว้ของคุณ

ขั้นตอนถัดไป

Anchor link to

หากต้องการเรียนรู้เพิ่มเติม โปรดดูที่ คู่มือการผสานรวมเบื้องต้น