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
-
Add the Teak pod.
In your Podfile add
pod 'Teak'to your primary target, then run
pod install. -
Open Xcode and select your project to view the list of targets.
-
Click the + button to add a new target.
-
Select Notification Service Extension then Next
-
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.
-
Open the NotificationService file and replace its contents with
Notification Serviceimport TeakExtension class NotificationService: TeakNotificationServiceCore { override func serviceExtensionTimeWillExpire() { super.serviceExtensionTimeWillExpire() } }
-
Add the Teak/Extension pod to your TeakNotificationService target.
In your Podfile add
target 'TeakNotificationService' do use_frameworks! pod 'Teak/Extension' endRun
pod install -
Click the + button to add a new target.
-
Select Notification Content Extension then Next
-
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.
-
Open the NotificationViewController file and replace its contents with
Notification View Controllerimport TeakExtension class NotificationViewController: TeakNotificationViewControllerCore { override func viewDidLoad() { super.viewDidLoad() } }
-
Open the Info file with an 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> -
Add the Teak/Extension pod to your TeakNotificationContent target.
In your Podfile add
target 'TeakNotificationContent' do use_frameworks! pod 'Teak/Extension' endRun
pod install