Adding the SDK and Rich Push Extensions

An example application with the Teak SDK integrated using CocoaPods is available at https://github.com/GoCarrot/TeakCocoaPodsExample

  1. Add the Teak pod.

    In your Podfile add

    pod 'Teak'

    to your primary target, then run pod install.

  2. Open Xcode and select your project to view the list of targets.

  3. Click the + button to add a new target.

    add target button
  4. Select Notification Service Extension then Next

    notification service extension
  5. Enter the product name as TeakNotificationService and click Finish

    Do not active the scheme on the dialog that is shown after clicking Finish.

    Press Don’t Activate on the Activate scheme prompt.

    add service extension
  6. Open the NotificationService file and replace its contents with

    Notification Service
    import TeakExtension
    
    class NotificationService: TeakNotificationServiceCore {
        override func serviceExtensionTimeWillExpire() {
            super.serviceExtensionTimeWillExpire()
        }
    }
    notification service code
  7. Add the Teak/Extension pod to your TeakNotificationService target.

    In your Podfile add

    target 'TeakNotificationService' do
      use_frameworks!
    
      pod 'Teak/Extension'
    end

    Run pod install

  8. Click the + button to add a new target.

    add target button
  9. Select Notification Content Extension then Next

    notification content extension
  10. Enter the product name as TeakContentExtension and click Finish

    Do not active the scheme on the dialog that is shown after clicking Finish.

    Press Don’t Activate on the Activate scheme prompt.

    add content extension
  11. Open the NotificationViewController file and replace its contents with

    Notification View Controller
    import TeakExtension
    
    class NotificationViewController: TeakNotificationViewControllerCore {
        override func viewDidLoad() {
            super.viewDidLoad()
        }
    }
    notification extension code
  12. Open the Info file with an External Editor

    info external editor

    Replace its contents with

    Content Extension Info.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>NSExtension</key>
        <dict>
            <key>NSExtensionAttributes</key>
            <dict>
                <key>UNNotificationExtensionCategory</key>
                <array>
                    <string>TeakNotificationContent</string>
                    <string>TeakNotificationPlayNow</string>
                    <string>TeakNotificationClaimForFree</string>
                    <string>TeakNotificationBox123</string>
                    <string>TeakNotificationGetNow</string>
                    <string>TeakNotificationBuyNow</string>
                    <string>TeakNotificationInteractiveStop</string>
                    <string>TeakNotificationLaughingEmoji</string>
                    <string>TeakNotificationThumbsUpEmoji</string>
                    <string>TeakNotificationPartyEmoji</string>
                    <string>TeakNotificationSlotEmoji</string>
                    <string>TeakNotification123</string>
                    <string>TeakNotificationFreeGiftEmoji</string>
                    <string>TeakNotificationYes</string>
                    <string>TeakNotificationYesNo</string>
                    <string>TeakNotificationAccept</string>
                    <string>TeakNotificationOkay</string>
                    <string>TeakNotificationYesPlease</string>
                    <string>TeakNotificationClaimFreeBonus</string>
                </array>
                <key>UNNotificationExtensionDefaultContentHidden</key>
                <false/>
                <key>UNNotificationExtensionInitialContentSizeRatio</key>
                <real>0.01</real>
                <key>UNNotificationExtensionUserInteractionEnabled</key>
                <true/>
            </dict>
            <key>NSExtensionPointIdentifier</key>
            <string>com.apple.usernotifications.content-extension</string>
            <key>NSExtensionPrincipalClass</key>
            <string>$(PRODUCT_MODULE_NAME).NotificationViewController</string>
        </dict>
    </dict>
    </plist>
  13. Add the Teak/Extension pod to your TeakNotificationContent target.

    In your Podfile add

    target 'TeakNotificationContent' do
      use_frameworks!
    
      pod 'Teak/Extension'
    end

    Run pod install