CocoaPods trunk is moving to be read-only. Read more on the blog, there are 9 months to go.

QpidSDK 1.3.0

QpidSDK 1.3.0

License Custom
ReleasedLast Release May 2020

Maintained by Mj Cho, Quintet.




QpidSDK 1.3.0

Qpid

The Quality Promised Information Deliverer.
Quick Feed.

License
CocoaPods
Platform

Mobile SDK for MQTT push library. Now you can deliver any message without worries.

Documentation

You can look into more detailed documents in here.

Features

  • MQTT Protocol.
  • Continuous Background Activation.
  • Response Tracking.
  • Serial Queuing.
  • Concurrent Execution.
  • Customizable Data Structure.
  • Default UI Providing. (iOS 8 above)

Requirements

  • iOS 8.0+
  • Latest version Xcode 9.1

Installation

CocoaPods

You can use CocoaPods to install QpidSDK by adding it to your Podfile:

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

To get started with it, import QpidSDK wherever you want to play or record.

import QpidSDK
@import <QpidSDK/QpidSDK.h>

Manually

  1. Download and drag/drop QpidSDK.framework in your project.
  2. Add icucore and sqlite3 and zlib library in your project.
  3. Congratulations!

Configuration

Setting in Info.plist

Some of pre-define value should be configured in Plist file.

Qpid Configuration

<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 key

String value. The API key that is provided which specified your app.

API Token

String value. The token that is provided to use the API.

Base URL

String value. The URL which server you want to connect.

Debug Level

Integer value. 0~5 log level. 0 is off and 5 is verbose. If set as Off, below values are ignored.

Debug on Console

Boolean value. Whether you want to print log on debug console.

Debug on File

Boolean value. Whether you want to print log on file.

Debug on Screen

Boolean value. Whether you want to print log on screen.

NSAppTransportSecurity

Allow all, or the URL we provided. This is needed to be able to make a network connection.

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

More info : Document / Video (WWDC 2015-711)

UIBackgroundModes

SDK will work in background cause of some particular reasons.

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

This SDK will cover the non-reached message by fetching in background.

remote-notification

This SDK will try to connect to the server when it's necessary via remote-notification

AppDelegate

You need to implement life cycle methods in AppDelegate of your app.

-application:didFinishLaunchingWithOptions:

When the app launched, this method will be called. It's best place to initialize SDK and deliver the options.

- (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:

When the app has registered for remote notification, this method will be called. As long as the SDK is Enabled this is where connection established.

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

When the fetch of UIBackgroundModes started to work, this method will be called. SDK will also fetch undelivered messages.

- (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:

When there is no established connection with server, server will try to connect via this method. This method will get called when the app got push notifications.

- (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

All the notifications and other info will be delivered from the delegate below. You must call -complete method after you handled the event.

-maxConcurrentMessageCount

Determine how many messages app will handle a time.

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

This method will deliver the message. Your magic code should be in this delegate. You must call -complete method after you handled the event.

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

This method will be called when you complete the message. You can do post action here.

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

Any errors that might help you to find issues will be delivered with this method.

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

Release History

1.0.14 - 2017-03-3

  • Fixed
    • Fixed typo in command delete query.

1.0.13 - 2017-03-3

  • Added
    • Added expired date for handling duplicated message.
  • Fixed
    • Fixed possible mis-behavior on duplicated message.

1.0.12 - 2017-01-31

  • Fixed
    • Fixed possible crash on DB handling.

1.0.11 - 2017-01-26

  • Fixed
    • Fixed wrong URL initialization.

1.0.10 - 2017-01-25

  • Added
    • Added User-defined data support.
    • Added didCompleteMessage: delegate.
  • Removed
    • Removed shouldPostNotificationMessage delegate.
  • Fixed
    • Fixed crash issue on resetting session.

Contacts

MJ – [email protected]

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