SDK iOS
Para instalar o SDK Dito em seu projeto é necessário arrastar o arquivo DitoSDK.framework, disponível na pasta Framework do projeto.
Há neste repositório presente na pasta Example a forma de utilização e configuração do SDK.
É necessário setar o App Key
e App secret
do seu dashboard Dito no arquivo .plist
do seu projeto, utilizar as chaves exatamente como no exemplo abaixo:
É necessário fazer a inicialização do SDK no arquivo AppDelegate.swift
do seu projeto.
import DitoSDK
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
Dito.shared.configure()
...
}
let customData = ["x": "y"]
let ditoUser = DitoUser(name: "My name",
gender: .masculino,
email: "[email protected]",
birthday: Date(),
location: "My city",
createdAt: Date(),
customData: customData)
Dito.identify(id: "My user id", data: ditoUser)
let event = DitoEvent(action: "my-current-event-to-track")
Dito.track(event: event)
Dito.registerDevice(token: "My notification token", tokenType: .apple)
Dito.unregisterDevice(token: "My notification token", tokenType: .apple)
O método recebe como parâmetro um dictionary
que é enviado no push. Não necessáriamente precisa ser implementado no método do delegate como no exemplo abaixo:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Dito.notificationRead(with: userInfo)
}
Também é possível obter o deepLink
para direcionamento de fluxo como no exemplo abaixo:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let notificationRead = Dito.notificationRead(with: userInfo)
print(notificationRead.deepLink)
}
Para ativar os logs é necessário colocar a flag EnabledDebug
ativada no Arguments Passed On Launch
que fica no scheme
do seu projeto.
ioasys, [email protected]
DitoSDK is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 0 |
Last commit: 17 hours ago |
Full Changelog: https://github.com/ditointernet/dito_ios/compare/v0.0.2...v0.0.3
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics