QpidSDK 1.3.0

QpidSDK 1.3.0

许可 自定义
发布最后发布2020 年 5 月

Mj ChoQuintet 维护。




QpidSDK 1.3.0

Qpid

质量保证信息传递者。
快速推送。

License
CocoaPods
Platform

适用于 MQTT 推送库的移动 SDK。现在您可以无忧地传递任何消息。

文档

您可以在这里查看更详细的文档。

特性

  • MQTT 协议。
  • 持续后台激活。
  • 响应跟踪。
  • 串行排队。
  • 并发执行。
  • 可定制数据结构。
  • 默认 UI 提供支持。(iOS 8 及以上版本)

要求

  • iOS 8.0+
  • 最新版 Xcode 9.1

安装

CocoaPods

您可以使用 CocoaPods 通过将其添加到您的 Podfile 来安装 QpidSDK

platform :ios, '8.0'
use_frameworks!
pod 'QpidSDK'

要开始使用它,在您想播放或录制的位置导入 QpidSDK

import QpidSDK
@import <QpidSDK/QpidSDK.h>

手动

  1. 下载并将 QpidSDK.framework 拖放到您的项目中。
  2. icucoresqlite3zlib 库添加到您的项目中。
  3. 恭喜!

配置

Info.plist 中设置

一些预定义值应在 Plist 文件中配置。

Qpid 配置

<key>Qpid Configuration</key>
<dict>
    <key>API Key</key>
    <string>585a0b3d6ccb780de407d2ef</string>
    <key>API Token</key>
    <string>336f3d2a-44d6-49f3-8fbc-22b37953ad65</string>
    <key>Base URL</key>
    <string>tcp://14.63.173.15:1883</string>
    <key>Debug Level</key>
    <integer>5</integer>
    <key>Debug on Console</key>
    <true/>
    <key>Debug on File</key>
    <true/>
    <key>Debug on Screen</key>
    <true/>
</dict>
API 密钥

字符串值。提供的 API 密钥指定了您的应用程序。

API 令牌

字符串值。提供的用于使用 API 的令牌。

基础 URL

字符串值。您要连接的服务器 URL。

调试级别

整数值。0~5 级日志。0 是 ,5 是 详细。如果设置为关,则忽略以下值。

在控制台调试

布尔值。是否要在调试控制台打印日志。

在文件中调试

布尔值。是否要在文件中打印日志。

在屏幕上调试

布尔值。是否要在屏幕上打印日志。

NSAppTransportSecurity

允许所有,或我们提供的 URL。这是建立网络连接所需的。

<key>NSAppTransportSecurity</key>
<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
</dict>

更多信息:文档 / 视频(WWDC 2015-711)

UIBackgroundModes

由于某些特定原因,SDK 将在后台运行。

<key>UIBackgroundModes</key>
<array>
		<string>fetch</string>
		<string>remote-notification</string>
</array>
fetch

此 SDK 将通过后台获取覆盖到的未到达消息。

remote-notification

此 SDK 将在必要时通过 remote-notification 尝试连接到服务器。

AppDelegate

您需要在应用程序的 AppDelegate 中实现生命周期方法。

-application:didFinishLaunchingWithOptions

当应用程序启动时,此方法将被调用。这是初始化 SDK 和传递选项的最佳位置。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [Qpid requestNotificationAuthorizationWithDelegate:self];
    [Qpid setDelegate:self];
    [Qpid handlingLaunchWithOptions:launchOptions];

    return YES;
}
-application:didRegisterForRemoteNotificationsWithDeviceToken

当应用程序已注册远程通知时,此方法将被调用。只要 SDK 是 Enabled,这是建立连接的地方。

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [Qpid setPushToken:deviceToken];
}
-application:performFetchWithCompletionHandler

UIBackgroundModesfetch开始工作,此方法将被调用。SDK还将获取未发送的消息。

- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    [Qpid handlingPerformFetchWithCompletionHandler:^(UIBackgroundFetchResult qpidResult) {
        // do your thing here and call `completionHandler`
        UIBackgroundFetchResult myResult = UIBackgroundFetchResultNoData; // your result..
        completionHandler(MIN(qpidResult, myResult));
    }];
}
-application:didReceiveRemoteNotification:fetchCompletionHandler

当没有与服务器建立连接时,服务器将尝试通过此方法连接。应用程序收到推送通知时,此方法将被调用。

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
    if (![Qpid handlingRemoteNotification:userInfo fetchCompletionHandler:completionHandler]) {
        // It's not from Qpid.
        completionHandler(UIBackgroundFetchResultNewData); // or UIBackgroundFetchResultNoData or UIBackgroundFetchResultFailed
    }
}

QPMessageEvent

所有通知和其他信息将通过以下代理传达。 您必须在处理完事件后调用-complete方法。

-maxConcurrentMessageCount

确定应用程序一次性处理的请求数量。

- (NSUInteger)maxConcurrentMessageCount
{
    return UINT_MAX;
}
-didGetNewMessage

此方法将通过消息。您的神奇代码应在此代理中。 您必须在处理完事件后调用-complete方法。

- (void)didGetNewMessage:(QPMessage *)message
{
    NSLog(@"message : %@", message);
    [QPUIManager presentAlertFromMessage:message onWindow:self.window dismissHandler:nil];
}
-didCompleteMessage

当您完成消息时,将调用此方法。您可以在其中执行后续操作。

- (void)didGetNewMessage:(QPMessage *)message
{
    NSLog(@"message : %@", message);
    [QPUIManager presentAlertFromMessage:message onWindow:self.window dismissHandler:nil];
}
-didFailedWithError

可能会帮助您找到问题的任何错误将通过此方法传达。

- (void)didFailedWithError:(NSError *)error
{
    NSLog(@"error : %@", error);
}

版本历史

1.0.14 - 2017-03-3

  • 修复
    • 修复了命令删除查询中的错误。

1.0.13 - 2017-03-3

  • 新增
    • 新增了处理重复消息的过期日期。
  • 修复
    • 修复了可能的重复消息行为问题。

1.0.12 - 2017-01-31

  • 修复
    • 修复了数据库处理的可能的崩溃。

1.0.11 - 2017-01-26

  • 修复
    • 修复了错误的URL初始化。

1.0.10 - 2017-01-25

  • 新增
    • 添加了用户定义数据支持。
    • 添加了didCompleteMessage: 代理。
  • 移除
    • 移除了shouldPostNotificationMessage 代理。
  • 修复
    • 修复了重置会话时的崩溃问题。

联系人

MJ – [email protected]

http://rep.yellomarket.co.kr:8000/Qpid/QpidSDK-pod