# iOS इंटरैक्टिव पुश बनाएँ

iOS 8 ने इंटरैक्टिव नोटिफिकेशन पेश किए, जिससे उपयोगकर्ता सीधे नोटिफिकेशन बैनर से कार्रवाई कर सकते हैं। Pushwoosh अब **iOS श्रेणियाँ** प्रदान करता है, जो आपको Pushwoosh कंट्रोल पैनल के भीतर कस्टम बटन बनाने में सक्षम बनाता है। [और जानें](/hi/product/messaging-channels/push-notifications/advanced-push-features/ios-interactive-push)

## API

जब आपका एप्लिकेशन [`registerDevice`](/hi/developer/api-reference/device-api/#registerdevice) को कॉल करता है, तो Pushwoosh API एक प्रतिक्रिया लौटाता है जिसमें उपलब्ध श्रेणियों की एक सूची होती है, जिसमें उनकी आईडी और प्रत्येक बटन के लिए विवरण निम्नानुसार होते हैं:

```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "iosCategories": [
      {
        "categoryId": 65,
        "buttons": [
          {
            "id": 0,
            "label": "Rate",
            "type": "1",
            "startApplication": 1
          },
          {
            "id": 1,
            "label": "Later",
            "type": "0",
            "startApplication": 0
          }
        ]
      }
    ]
  }
}
```

ये श्रेणियाँ अब डिवाइस पर उपलब्ध हैं, इसलिए जब कोई संदेश आता है और आपका एप्लिकेशन फोरग्राउंड में नहीं चल रहा होता है, तो उन्हें ठीक से प्रदर्शित किया जा सकता है।

Pushwoosh Journey से एक श्रेणी के साथ अपना पुश भेजने के लिए, बस अपना संदेश लिखते समय इसे iOS प्लेटफ़ॉर्म सेटिंग्स में चुनें। यदि आप Pushwoosh API के माध्यम से दूरस्थ रूप से अपने पुश भेज रहे हैं, तो [`createMessage`](/hi/developer/api-reference/messages-api/#createmessage) अनुरोधों में आपको `ios_category` पैरामीटर का उपयोग एक संबंधित श्रेणी आईडी के मान के रूप में करना चाहिए:

```json
{
  "categoryId": 65  // Optional. String value. iOS8 category ID from Pushwoosh
}
```

जब एक श्रेणी आईडी वाला पुश संदेश आता है, तो Pushwoosh SDK इस श्रेणी में मौजूद बटनों के एक सेट के साथ नोटिफिकेशन प्रदर्शित करता है।

## Pushwoosh iOS SDK में बटन और एक्शन

ऐप खोलने पर विभिन्न क्रियाएं करने के लिए, आपको एक कस्टम `UNUserNotificationCenterDelegate` कार्यान्वयन बनाना चाहिए और इसकी `didReceiveNotificationResponse` विधि को ओवरराइड करना चाहिए:

#### CustomDelegate


```swift
class CustomDelegate: NSObject, UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let identifier = response.actionIdentifier
        let category = response.notification.request.content.categoryIdentifier

        if category == "10212" {
            if identifier == "1" {
                // DO SOMETHING
            } else {
                // DO SOMETHING ELSE
            }
        }

        completionHandler()
    }
}
```

जहाँ `identifier` एक बटन आईडी है, और `category` नोटिफिकेशन पेलोड से प्राप्त होता है।

फिर, इस वर्ग का एक उदाहरण बनाएँ और इसे प्रॉक्सी विधि का उपयोग करके Pushwoosh SDK में पास करें:

#### AppDelegate

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    Pushwoosh.configure.registerForPushNotifications()

    let customDelegate = CustomDelegate()
    Pushwoosh.configure.addNotificationCenterDelegate(customDelegate)

    return true
}
```

<img src="/messaging-channels-ios-interactive-push-1.png" alt="नोटिफिकेशन बैनर में प्रदर्शित कस्टम एक्शन बटन के साथ iOS इंटरैक्टिव पुश नोटिफिकेशन"/>