Upgrading to iOS SDK v4
Upgrade the version of the WonderPush SDK
If you're using CocoaPods integration
Edit your Podfile
and change the version in the lines referencing the WonderPush
and WonderPushExtension
pods:
Replace this:
pod 'WonderPush', '~> 3.0' # ← Update the version here
# [...]
pod 'WonderPushExtension', '~> 3.0' # ← Update the version here
with that:
pod 'WonderPush', '~> 4.0' # ← Update the version here
# [...]
pod 'WonderPushExtension', '~> 4.0' # ← Update the version here
Then run:
pod install
If you're using the manual integration
- Open your Xcode project.
- Remove
WonderPush.framework
andWonderPushExtension.framework
and choose "Move to trash". - Repeat Step 4. Integrate WonderPush to your Xcode project in the Manual iOS integration guide.
If you're using the Carthage integration
Change your Cartfile
to replace this:
github "wonderpush/wonderpush-ios-sdk" ~> 3.0.0
with that:
github "wonderpush/wonderpush-ios-sdk" ~> 4.0.0
And run:
carthage update
Changes to the Notification Service Extension
Provide your clientId and clientSecret to your Notification Service Extension. Find your WonderPushNotificationServiceExtension/NotificationService.swift
file and override the following two methods:
import WonderPushExtension
class NotificationService: WPNotificationServiceExtension {
override class func clientId() -> String {
return "YOUR_CLIENT_ID"
}
override class func clientSecret() -> String {
return "YOUR_CLIENT_SECRET"
}
}
#import "NotificationService.h"
@implementation NotificationService
+ (NSString *)clientId {
return @"YOUR_CLIENT_ID";
}
+ (NSString *)clientSecret {
return @"YOUR_CLIENT_SECRET";
}
@end
Make sure to give the same values as in your AppDelegate
.
Remove calls to deprecated APIs
Remove any calls to isReady:
and subscriptions to the WP_NOTIFICATION_INITIALIZED
NSNotification.
You do not need to wait to use WonderPush.
You're done!
Updated about 4 years ago