测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2016年2月 |
由 Donky Networks Ltd 维护。
Donky iOS SDK 是用于向您的应用添加推送通知和丰富内容服务的工具集。有关详细文档、教程和指南,请访问我们的在线文档:http://docs.mobiledonky.com。
Donky Module SDK 的最低技术要求如下:
阅读我们完整的文档此处。
Donky Networks Ltd, [email protected]
DonkySDK-iOS-Modular 的许可证为 MIT。有关更多信息,请参阅 LICENSE 文件。
请使用以下方法之一进行安装:
克隆 Git 存储库
git clone [email protected]:Donky-Network/DonkySDK-iOS-Modular.git
使用 CocoaPods
Please see below for all the information specific to the CocoaPods
如果您在集成或使用该 SDK 时遇到任何问题,请联系 [email protected]。
我们接受Pull请求!
只有当您只使用 SDK 的这部分时,才将其添加到您的 'Podfile' 中。如果使用任何附加的可选模块,则无需在 'Podfile' 中添加此内容。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Start analytics (optional)
[[DCAAnalyticsController sharedInstance] start];
//Initialise Donky with API key.
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Start analytics (optional)
[[DCAAnalyticsController sharedInstance] start];
//Create a new user and populate with details. Country code is optional is NO mobile number is provided. If a
//mobile number is provided then a country code is mandatory. Failing to provide a country code that matches the
//mobile number will result in a server validation error.
DNUserDetails *userDetails = [[DNUserDetails alloc] initWithUserID:@""
displayName:@""
emailAddress:@""
mobileNumber:@""
countryCode:@""
firstName:@""
lastName:@""
avatarID:@""
selectedTags:@[]
additionalProperties:@{}];
//Initialise Donky with API key.
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY" userDetails:userDetails success:^(NSURLSessionDataTask *task, id responseData) {
NSLog(@"Successfully Initialised with user...");
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"%@", [error localizedDescription]);
}];
return YES
}
您还必须调用以下的应用程序代理中的方法,以确保快速接收和处理自定义内容通知
以确保将您的设备标识符发送到 Donky 网络上
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
为了处理传入的通知,使用此方法允许您的应用程序处理启用内容的通知
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
处理交互式通知(仅支持iOS 8及更高版本)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
示例项目可在此处找到
│
├───src
├───workspaces
├───Donky Core SDK Demo
Donky-Core-SDK可通过CocoaPods获得。要安装它,只需将以下行添加到您的Podfile中.
pod "Donky-Core-SDK"
使用简单推送模块使您的应用程序能够接收简单推送消息。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Start analytics (optional)
[[DCAAnalyticsController sharedInstance] start];
//Start push logic:
[[DPPushNotificationController sharedInstance] start];
//Initialise Donky
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
您还必须调用应用程序代理以下方法
以确保将您的设备标识符发送到 Donky 网络上
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
为了处理传入的通知,使用此方法允许您的应用程序处理启用内容的通知
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
处理交互式通知(仅支持iOS 8及更高版本)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
示例项目可在此处找到
│
├───src
├───workspaces
├───Donky Simple Push Logic Demo
pod "Donky-SimplePush-Logic"
将其加入您的 podfile 将自动拉入以下其他模块,因为它们是硬依赖。无需手动包含以下任何内容
使用富消息模块使您的应用程序能够从网络接收并保存富消息到 Donky 的本地数据库。然后您可以通过 objective-c DRLogicMainController
中提供的 API 调用检索和删除消息。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//Start analytics controller (optional)
[[DCAAnalyticsController sharedInstance] start];
//Start the Rich Logic
[[DRLogicMainController sharedInstance] start];
//Initialise Donky
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-Key"];
return YES;
}
您还必须调用应用程序代理以下方法
以确保将您的设备标识符发送到 Donky 网络上
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
为了处理传入的通知,使用此方法允许您的应用程序处理启用内容的通知
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
处理交互式通知(仅支持iOS 8及更高版本)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
示例项目可在此处找到
│
├───src
├───workspaces
├───Donky Rich Message Logic Demo
pod "Donky-RichMessage-Logic"
将其加入您的 podfile 将自动拉入以下其他模块,因为它们是硬依赖。无需手动包含以下任何内容
使用富消息模块使您的应用程序能够接收和显示我们预构建 UI 中的富消息。
示例项目可在此处找到
│
├───src
├───workspaces
├───Donky Rich Message Inbox Demo
pod "Donky-RichMessage-Inbox"
将其加入您的 podfile 将自动拉入以下其他模块,因为它们是硬依赖。无需手动包含以下任何内容
使用自动化模块启用在“活动构建器/Donky控制”上设置的营销活动点击此处。
按正常方式启动Donky SDK和分析控制器。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//Start analytics module (optional)
[[DCAAnalyticsController sharedInstance] start];
//Initialise Donky
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
要触发触发器,可以使用以下任一方法
[DAAutomationController executeThirdPartyTriggerWithKey:@"Trigger-Key" customData:@{}];
[DAAutomationController executeThirdPartyTriggerWithKeyImmediately:@"Trigger-Key" customData:@{}];
示例项目可在此处找到
│
├───src
├───workspaces
├───Donky Automation Demo
pod "Donky-Automation-Logic"
将其加入您的 podfile 将自动拉入以下其他模块,因为它们是硬依赖。无需手动包含以下任何内容
使用此模块,您可以针对各种消息类型保存音频文件,并允许在接收到此类消息时自动播放它们。点击此处。
启动控制器
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[DAMainController sharedInstance] start];
//Other donky modules or custom code:
return YES;
}
要设置声音文件,此方法接受文件的NSURL。
[[DAMainController sharedInstance] setAudioFile:<#(NSURL *)#> forMessageType:<#(DonkyAudioMessageTypes)#>];
要播放声音文件
[[DAMainController sharedInstance] playAudioFileForMessage:<#(DonkyAudioMessageTypes)#>];
│
├───src
├───workspaces
├───Donky Audio
pod "Donky-CommonMessaging-Audio"
无
使用此模块,您可以多次调用某些账号控制方法,而无需实现回调或担心在更改本地和网络状态时的顺序。
该模块覆盖以下方法内部
DNSequencingAccountController
+ (void)updateAdditionalProperties:(NSDictionary *)newAdditionalProperties success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)saveUserTags:(NSMutableArray *)tags success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)updateUserDetails:(DNUserDetails *)userDetails success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)updateRegistrationDetails:(DNUserDetails *)userDetails deviceDetails:(DNDeviceDetails *)deviceDetails success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)updateDeviceDetails:(DNDeviceDetails *)deviceDetails success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
pod "Donky-Core-Sequencing"
将其加入您的 podfile 将自动拉入以下其他模块,因为它们是硬依赖。无需手动包含以下任何内容
您永远不需要手动将通用逻辑模块添加到应用程序中,它是一个PodSpec依赖,因此无需手动添加到PodFile中。
您永远不需要手动将常见的UI模块添加到您的应用程序中,它是一个PodSpec依赖关系,因此不需要在PodFile中手动添加。